VUE~~~通過首頁鏈接到功能點對應的tab頁(同一頁面,不需打開多個頁面)

如果想要鏈接到同一個頁面,路由跳轉需要用name而不是path

//router.config.js
{
    path: '/mainitem',
    name: 'MainItem',
    component: () => import('@/views/mainitem/MainItem'),
    meta: { title: '項目信息', keepAlive: true, icon: 'gold', permission: ['01', '09']}
}
//
g.routerurl = { name: "MainItem", params: { activeKey: "1" } }
<router-link :to="g.routerurl">
    <img :src="g.url" height="32px" />
    <p>{{ g.text }}</p>
</router-link>
//
activated () {
    this.activeKey = this.$route.params.activeKey ? this.$route.params.activeKey : '1'
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章