1、如果我没理解错,(如果是图标,准备两个标图,一个高亮一个不高亮)在标签中,使用v-if=" this.$route.path = '路由路径' "判断;如果不是路由,使用window.location.href读取当前页面URL,再截取判断。 2、直接显示页面,在路由中写{path:"/",redirect:组件名}即可。比如:var router=new VueRouter({ routes:[ {path:'/',component:index}, {path:'/main',component:main, children:[ {path:'/',redirect:二级页面的组件名}, //当URL路径到xxx.com#/main的时候就会显示这个组件 {path:'二级页面路径',component:二级页面组件名} //...其它二级页面 ] } ] })
1、如果我没理解错,(如果是图标,准备两个标图,一个高亮一个不高亮)
在标签中,使用v-if=" this.$route.path = '路由路径' "判断;
如果不是路由,使用window.location.href读取当前页面URL,再截取判断。
2、直接显示页面,在路由中写{path:"/",redirect:组件名}即可。比如:
var router=new VueRouter({
})