2021-08-25 17:52:20 +08:00
|
|
|
import 'iframe-resizer/js/iframeResizer.contentWindow'
|
|
|
|
import './style.scss'
|
|
|
|
|
2022-06-08 20:10:25 +08:00
|
|
|
import { createApp } from 'vue'
|
|
|
|
|
2023-07-01 03:03:49 +08:00
|
|
|
import { debug, splitName } from './helper.js'
|
2022-06-08 20:10:25 +08:00
|
|
|
|
2021-08-25 17:52:20 +08:00
|
|
|
export default function init(name: string, source: any) {
|
|
|
|
// @ts-ignore
|
|
|
|
window.source = source
|
|
|
|
document.title = name
|
|
|
|
|
2023-06-02 00:21:47 +08:00
|
|
|
const [demoCategory, demoName, frameworkName] = splitName(name)
|
2021-08-25 17:52:20 +08:00
|
|
|
|
2023-06-02 00:21:47 +08:00
|
|
|
import(`../src/${demoCategory}/${demoName}/${frameworkName}/index.vue`)
|
2021-08-25 17:52:20 +08:00
|
|
|
.then(module => {
|
2024-07-29 23:02:15 +08:00
|
|
|
const app = createApp(module.default)
|
|
|
|
|
|
|
|
if (typeof module.configureApp === 'function') {
|
|
|
|
module.configureApp(app)
|
|
|
|
}
|
|
|
|
app.mount('#app')
|
2021-08-25 17:52:20 +08:00
|
|
|
debug()
|
|
|
|
})
|
|
|
|
}
|