import PhotoShow from '../pages/photo/show.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/photo/show/:id',
props: true,
name: 'PhotoShow',
component: PhotoShow,
meta: { title: '图片浏览' }
}
]
const router = new VueRouter({
routes,
linkActiveClass: 'mui-active'
})
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
}
next()
})
export default router
vue-router中router写法案例
最新推荐文章于 2024-04-27 23:45:16 发布