鍍金池/ 問答/HTML/ vue 在vue-router中使用嵌套命名視圖的方式引入多個組件,在另外頁面引

vue 在vue-router中使用嵌套命名視圖的方式引入多個組件,在另外頁面引用相同不刷新,求解

在router.js中,由于多個頁面中都會使用到面包屑組件,因此采用了嵌套命名視圖的方式來引用面包屑組件:

{
    path: '/Manage',
    name: '系統(tǒng)管理',
    component: function(res) {
        require(['../components/common/layoutComponent'], res)
            },
        props: true,
        children: [
            {
                path: '/Manage/ProjectManage',
                name: '項目類型',
                components:  {
                    default: function(res) {
                        require(['../components/work/SystemManage/ProjectManage'], res)
                        },
                    breadHelp: function(res) {
                        require(['../components/common/breadCrumb/breadForSystemManage'], res)
                    },
                },
                props: true,
            },]

在整體布局中:

<el-main class="mainDiv">
    <!-- <breadForSystemManage></breadForSystemManage> -->
    <router-view name="breadHelp"/>
    <router-view/>
</el-main>

現在頁面里,跳轉路由的時候,在同樣引用了面包屑的頁面,無論怎樣跳轉面包屑都不會更新,請問可能是在哪里缺失了處理?

回答
編輯回答
尛憇藌

已解決:
在面包屑組件里面通過watch來監(jiān)聽路由更新組件

2017年1月21日 23:18