blessing-skin-server/resources/assets/src/index.ts
2019-12-01 18:08:21 +08:00

28 lines
646 B
TypeScript

import Vue from 'vue'
import './scripts/app'
import routes from './scripts/route'
Vue.config.productionTip = false
loadModules()
function loadModules() {
const route = routes.find(
// eslint-disable-next-line no-shadow
route => new RegExp(`^${route.path}$`, 'i').test(blessing.route),
)
if (route) {
if (route.module) {
Promise.all(route.module.map(m => m()))
}
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,
render: h => h(route.component),
})
}
}
}