Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将jquery插件与Meteor中收集的数据绑定_Jquery_Meteor - Fatal编程技术网

如何将jquery插件与Meteor中收集的数据绑定

如何将jquery插件与Meteor中收集的数据绑定,jquery,meteor,Jquery,Meteor,我想使用jquery jcountdown插件,但我有一个问题。 计时器的开始时间存储在集合中,它是插件初始化所必需的。 我想做一些类似的事情: var time = SeqTimestamp.findOne({}).time; $('.countdown').countdown({date: new Date}); 呈现回调运行一次,并没有看到集合对我来说不是很好的点。 我如何才能做到这一点?试着这样做: Template.whatever.rendered = function (

我想使用jquery jcountdown插件,但我有一个问题。 计时器的开始时间存储在集合中,它是插件初始化所必需的。 我想做一些类似的事情:

  var time = SeqTimestamp.findOne({}).time;
  $('.countdown').countdown({date: new Date});
呈现回调运行一次,并没有看到集合对我来说不是很好的点。 我如何才能做到这一点?

试着这样做:

Template.whatever.rendered = function () {
  var self = this;
  self.autorun(function () {
    var data = SeqTimestamp.findOne({});
    if (data) {
      self.$('.countdown').countdown({date: data.time});
    }
  });
}

我会这样说:


{{{随着时间}
{{>whatever2}
{{else}
没时间了

{{/与}}
Template.whatever.helpers({
时间:函数(){
返回SeqTimestamp.findOne()
}
})

Template.whatever2.rendered=function(){
var theTime=this.data.theTime
这是。$('.countdown').countdown({date:theTime.time})
}