0
如何获得左侧(侧栏)的链接以在屏幕右侧打开单独的页面?铁路由器和流星所需的建议
我一直在浏览一些由谷歌搜索服务的教程。我尝试将{{> yield}}放在身体中,但是它会这样做,会弄乱所有的东西。我的理解是,收益必须放置在路由页必须出现的地方。请让我知道如何解决这个问题。
这里是我到目前为止的代码:
<body>
<div id= 'wrapper'>
<div id="sidebar-wrapper">
{{> SideBar}}
</div>
<div id="page-content-wrapper">
{{> PageContent}}
</div>
</div>
</body>
<template name ='SideBar'>
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">Start Bootstrap </a>
</li>
<li>
<a href="{{ pathFor 'Dashboard' }}">Dashboard</a>
</li>
<li>
<a href="{{ pathFor 'Overview' }}">Overview</a>
</li>
</ul>
</template>
<template name ='PageContent'>
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1>Simple Sidebar</h1>
**{{> yield}}**
</div>
</div>
</div>
</template>
点击仪表板/概述应该呈现下面的模板在屏幕的右侧
<template name ='Dashboard'>
<h1> testing dashboard</h1>
</template>
<template name ='Overview'>
<h1> testing Overview</h1>
</template>
这是我routes.js
Router.route('/Dashboard', function(){this.render('Dashboard');
});
Router.route('/Overview', function(){this.render('Overview');
});
Router.route('/profiles/manuel', function() {
this.layout('profileLayout');
this.render('profileDetail');
});
个Config.js:
Router.configure({
layoutTemplate: 'PageContent'
});
你的意思是...做到这一点? <模板名称= 'profileLayout'>
是的,没有它的工作? –
我重写了整个页面容器。基本上删除每个模板,然后创建一个包含侧栏和右侧显示容器的大模板。我还将铁路路由器中的默认模板设置为指向侧栏,以便它在所有页面上都显示为静态。它现在起作用。直到我再次打破它。 – blueren