我可以解释一下我想要做什么,但是这个ReactJS示例正是我想要的演练.问题是我无法弄清楚equivelant对原生的反应是什么.
基本上,当我按下TextInput中的return时,我想清除文本并保持焦点.
有什么想法吗?
我今天刚刚开始使用流星,似乎无法弄清楚我做错了什么.我有一个在发布函数内运行的查询,但此查询是由另一个查询的结果过滤的.
简而言之,当我将文档添加到正在发布的数据库(CollectionTwo)时,它可以像我期望的那样工作,但是当我在用于过滤(CollectionOne)的数据库中进行更改时,流星不会表现出反应性.
CollectionOne = new Meteor.Collection("one")
CollectionTwo = new Meteor.Collection("two")
Meteor.publish("items", ->
not_hidden = CollectionOne.find().fetch()
return CollectionTwo.find( _id: {'$in':( t.my_id for t in not_hidden )} )
)
Run Code Online (Sandbox Code Playgroud)
同时,在客户端......
CollectionOne = new Meteor.Collection("one")
CollectionTwo = new Meteor.Collection("two")
Meteor.subscribe("items")
_.extend( Template.items,
items: ->
not_hidden = CollectionOne.find().fetch()
return CollectionTwo.find( _id: {'$in':( t.my_id for t in not_hidden )} )
)
Run Code Online (Sandbox Code Playgroud)
任何想法适当的解决方案可能是什么?