小编Lau*_*che的帖子

如何在每种情况下访问数据上下文和模板实例(事件,帮助器,钩子)?

因为所有的不一致,我的大脑受到了伤害.请查看下面的代码并更正/完成它:

Template.Example.events({
  'click #example': function(event, template) {
    instance = template; // or = Template.instance();
    instance_reactive_data_context = template.currentData(); // or = Template.currentData();
    instance_nonreactive_data_context = ???
    event_data_context = event.currentTarget;
});

Template.Example.helpers({
  example: function() {
    instance = Template.instance();
    instance_reactive_data_context = this; // or = Template.currentData();
    instance_nonreactive_data_context = ???
  }
});

Template.Example.onCreated(function () {
  instance = this;
  instance_reactive_data_context = this.currentData();
  instance_nonreactive_data_context = this.data;
});
Run Code Online (Sandbox Code Playgroud)

meteor meteor-blaze meteor-helper

2
推荐指数
1
解决办法
1576
查看次数

标签 统计

meteor ×1

meteor-blaze ×1

meteor-helper ×1