vue后台系统侧边导航跳转页面
定义路由数组套json
导出路由数组
export { routes,router }
在主体内容区使用solt
<!-- 子组件中的 <slot>就是一个槽,可以接收父组件传过来的模板内容template, <slot> 元素自身将被替换 -->
<slot></slot>
获取点击的导航的下标传入参数获取指定路由的path跳转页面
<a-menu-item
v-for="(route, index) in routes"
:key="index"
@click="pages(route)"
>
<a-icon :type="route.icon" />
<span>{{ route.name }}</span>
</a-menu-item>
定义的方法:
pages (route) {
/* 参数 点击的那个路由对象 */
this.$router.push(route.path)
},
over