Files
dvcp_v2_webapp/examples/router/router.js

23 lines
417 B
JavaScript
Raw Normal View History

2021-12-14 18:36:19 +08:00
import Vue from 'vue'
import VueRouter from 'vue-router'
import autoRoutes from './autoRoutes'
Vue.use(VueRouter)
2022-04-27 18:18:57 +08:00
export default autoRoutes.init().then(() => new VueRouter({
2021-12-14 18:36:19 +08:00
mode: 'history',
hashbang: false,
2022-04-27 18:18:57 +08:00
routes: [
{path: "/", name: "产品库"},
...autoRoutes.routes
],
2021-12-14 18:36:19 +08:00
scrollBehavior(to) {
2022-04-27 18:18:57 +08:00
console.log(to)
2021-12-14 18:36:19 +08:00
if (to.hash) {
return {
selector: to.hash
}
}
}
2022-04-27 18:18:57 +08:00
}))