Allow loading pure script

This commit is contained in:
Pig Fang 2019-03-19 15:36:47 +08:00
parent d8295dff33
commit 33d431606d

View File

@ -13,20 +13,24 @@ if (process.env.NODE_ENV === 'development') {
setTimeout(langs.find(({ lang }) => lang === blessing.locale).load, 0)
}
(() => {
{
const route = routes.find(
// eslint-disable-next-line no-shadow
route => (new RegExp(`^${route.path}$`, 'i')).test(blessing.route)
)
if (route) {
Vue.prototype.$route = (new RegExp(`^${route.path}$`, 'i')).exec(blessing.route)
// eslint-disable-next-line no-new
new Vue({
el: route.el,
mounted() {
setTimeout(() => emitter.emit('mounted', { el: route.el }), 100)
},
render: h => h(route.component),
})
if (route.component) {
Vue.prototype.$route = (new RegExp(`^${route.path}$`, 'i')).exec(blessing.route)
// eslint-disable-next-line no-new
new Vue({
el: route.el,
mounted() {
setTimeout(() => emitter.emit('mounted', { el: route.el }), 100)
},
render: h => h(route.component),
})
} else if (route.script) {
route.script()
}
}
})()
}