【问题标题】:Access child template helpers/variables from parent in Meteor从 Meteor 中的父级访问子模板帮助器/变量
【发布时间】:2016-10-16 03:40:12
【问题描述】:

制作用户选择器控制器,但无法将用户从父级中取出。

父模板有

{{> userPicker}}

子更新响应式变量,存储为this.someVar = new ReactiveVar(...)

如何从父模板中获得对thisuserPicker 的引用?

【问题讨论】:

    标签: javascript meteor meteor-blaze


    【解决方案1】:

    我最终通过父母的引用传递了一本字典,并让孩子将东西放入其中。

    在父 html 中

    {{> userPicker userContext }}
    

    在父 js 中

    const users = {};
    

    作为帮手

    userContext() {
      return users;
    }
    

    【讨论】:

    • 您能否详细说明孩子是如何将东西放入 userContext 的?
    • 我认为你最好问一个新问题。好久没碰Meteor了。
    猜你喜欢
    • 2016-06-10
    • 2016-01-09
    • 2013-02-14
    • 2011-08-29
    • 2015-03-28
    • 2017-11-04
    • 1970-01-01
    • 1970-01-01
    • 2015-07-02
    相关资源
    最近更新 更多