使用循环来完成router-link的生成,并可以实现界面的路由
<p v-for="(operate,path,index) in navTo.operate" class="nav" @click="change(index)">
<router-link :to="{ path: operate.path }">
{{operate.name}}
</router-link>
<i class="el-icon-arrow-right right"></i>
</p>
export default {
name: 'HelloWorld',
data () {
return {
navTo:{
"operate":[
{"name":"系统1","path":'/header'},
{"name":"系统2","path":'/HelloWorld/engine'},
]
}
}
}
}
效果图
网友评论