naive-ui/demo/routes/router.js

28 lines
748 B
JavaScript
Raw Normal View History

import { createRouter, createWebHistory } from 'vue-router'
2020-03-20 17:32:05 +08:00
export default function createDemoRouter (app, routes) {
const router = createRouter({
history: createWebHistory(),
2020-03-20 17:32:05 +08:00
routes
})
// router.beforeEach(function (to, from, next) {
// let theme = to.params.theme
// if (theme === 'os-theme') {
// theme = app.config.globalProperties.$NOs.theme
// }
// app.config.globalProperties.$NLoadingBar.theme = theme
// if (to.path !== from.path) {
// app.config.globalProperties.$NLoadingBar.start()
// }
// next()
// })
// router.afterEach(function (to, from) {
// if (to.path !== from.path) {
// app.config.globalProperties.$NLoadingBar.finish()
// }
// })
2020-03-20 17:32:05 +08:00
return router
}