react里可以但是vue我不熟悉,没找到
App.vue是父` <nav>这里我想加载导航</nav>
<router-view class="router-view">这是路由</router-view>`
我的想法是导航这块也通过route的不同引入不同的内容!让每个页面的导航不一样!我应该怎么设计呢!
在react里是这么设计的
<div>
{ header }
{content || "没有内容"}
{ footer}
<Dialog show={this.state.msg_show} onOk={()=>{Session.set('msg_r','')}}>
{this.state.msg_r}
</Dialog>
</div>
然后子组件里去定义header和content等等
import layouts from './components/layouts';
import Index from './components/routes/Index/components/Index';
import IndexRoute from './components/routes/Index/route';
import ScannerRoute from './components/routes/Scanner/route';
const route = {
path: 'index',
indexRoute: {
getComponent(nextState, cb) {
cb(null, {
content:Index,
})
}
},
getComponent(nextState, cb) {
cb(null, {
content:layouts,
})
},
getChildRoutes(partialNextState, cb) {
cb(null, [
IndexRoute,
ScannerRoute
])
},
}
export default route;
vue里有没有类似的,关键在于nav必须根据网址的不同引入不同的文件夹里的文件
好像是这个:http://router.vuejs.org/zh-cn...
先研究下
指直接在子组件里用导航呗,需要什么导航就引入