addRoutes hAddRoute(){ this.$router.addRoutes([{ path:'/abc', component:()=>import('@/views/abc')">
赞
踩
// 动态生成路由
router.addRoutes([路由配置对象])
或者
this.$router.addRoutes([路由配置对象])
示例, 点击按钮,跳转abc页面
<button @click="hAddRoute"> addRoutes </button>
hAddRoute(){
this.$router.addRoutes([{
path:'/abc',
component:()=>import('@/views/abc')
}])
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。