gpt4 book ai didi

javascript - Meteor 嵌套 View 和产量

转载 作者:行者123 更新时间:2023-11-27 23:48:03 25 4
gpt4 key购买 nike

我正在设置我 future 的 meteor 应用程序的基本结构,我正在使用 meteor 和 Angular 。想要将 Iron 路由器与 ui 路由器结合起来,但结果很糟糕。因此,现在我又回到了普通 meteor 来解决路由问题,任务是拥有标准的多页面站点,但其中一个页面是一个具有自己的子页面的复杂面板。

所以我有一个带有>yield的全局布局,并且所有内容都在那里渲染,现在这个仪表板页面也渲染到这个yield中,但它必须有自己的yield。如何设置路由器才能使其正常工作?如何准备模板?

最佳答案

使用您首选的路由器进行顶层路由,然后对于要插入到仪表板中的模板使用 Template.dynamic

{{> Template.dynamic template=template [data=data] }}

  • Choose a template to include dynamically, by name.

Arguments

  • template String The name of the template to include.

  • data Object Optional. The data context in which to include the template.

Template.dynamic allows you to include a template by name, where the name may be calculated by a helper and may change reactively. The data argument is optional, and if it is omitted, the current data context is used.

For example, if there is a template named "foo", {{> Template.dynamic template="foo"}} is equivalent to {{> foo}}.

Here is a tutorial.

关于javascript - Meteor 嵌套 View 和产量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32980608/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com