鍍金池/ 問答/Linux  HTML/ vue路由跳轉(zhuǎn)怎么實(shí)現(xiàn)界面左右分層

vue路由跳轉(zhuǎn)怎么實(shí)現(xiàn)界面左右分層

跳轉(zhuǎn)按鈕與顯示內(nèi)容左右布局,而不是一般的上下分層顯示

回答
編輯回答
陌南塵

router-view啊,router-view引入的是公共部分,路由js里面配置
path:"/parent" ...
children:[

{
    path:"/a" ...
},
{
    path:"/b" ...
}
...

]

2017年10月9日 01:22
編輯回答
心悲涼

其實(shí)不要被常見的東西限制了想象, 容器的布局左右 上下原理是一模一樣的。
假設(shè)你的vue文件

<template>
    <div class="container">
        <div class="left-container-for-nav" >
            <left-nav></left-nav>
        </div>
        <div class="container-for-subVuePage">
            <router-view> </router-view>
        </div>
    </div>
</template>

router 假設(shè)這個組件跟路由是 test
那么


{    
    path: "/test",
    component: require('xxxx')
    children:[
        {
            path: "pageA",
            component: require('xxxx')
        },
        {
            path: "pageB",
            component: require('xxxx')
        }
    ]
}

那么 當(dāng)你訪問 /test/pageA /test/pageB 的時候left-container-for-nav 會一直在 pageA和pageB都會被渲染進(jìn)

<div class="container-for-subVuePage">
    <router-view> </router-view>
</div>

這個router-view里面

2017年12月7日 11:05
編輯回答
陌璃

用 css 不行嗎0-0

2018年9月16日 18:16