blob: 80a813f890674bfdab02d8a89c5186305faa811d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
const { createApp } = Vue
const { loadModule } = window['vue3-sfc-loader']
const addStyle = styleStr => {
const style = document.createElement('style')
const ref = document.head.getElementsByTagName('style')[0] || null
style.textContent = styleStr
document.head.insertBefore(style, ref)
}
const getFile = url => fetch(url).then(resp => resp.ok ? resp.text() : Promise.reject(resp))
const moduleCache = { vue: Vue }
const options = { addStyle, getFile, moduleCache }
const app = createApp({
components: {
App: Vue.defineAsyncComponent(() => loadModule('vue/App.vue', options)),
Section: Vue.defineAsyncComponent(() => loadModule('vue/Section.vue', options)),
Plot: Vue.defineAsyncComponent(() => loadModule('vue/Plot.vue', options)),
},
})
app.mount('#app')
|