流星.防止模板重新渲染或禁用反应性 [英] Meteor. Prevent template re-rendering or disable reactivity
问题描述
我有一个包含多个输入的模板.如果我快速填充它们,它们就会滞后,因为客户端和服务器之间存在延迟.有没有办法防止重新渲染当前输入?或者禁用对整个模板的反应性,然后手动重新渲染?
I have a template with multiple inputs. And they lag if i fill them quickly, because of the delay between the client and the server. Is there a way to prevent re-rendering of the current input? Or disable reactivity to the entire template, and re-render it manually?
如果我使用 keyup
事件,当前输入是滞后的,如果 change
然后是下一个.
If I use the keyup
event the current input is laggy, and if the change
then the next one.
我听说过 {{#isolate}}
和 {{#constant}}
但我找不到关于它的文档.
I heard about {{#isolate}}
and {{#constant}}
but I can't find the documentation about it.
推荐答案
如果您使用 find()
查询,您可以使用 reactive
选项将其关闭:
If you use a find()
query you can use the reactive
option to switch it off:
YourCollection.find({}, {reactive: false})
禁用反应性.
如果你使用变量,你可以使用普通的 var variablename
而不是 Session.get('variableName')
或 ReactiveDict
类型变量来禁用它们的反应性.
If you use variables you could use ordinary var variablename
instead of Session.get('variableName')
or ReactiveDict
type variables to disable their reactivity.
{{#isolate}}
和 {{#constant}}
已被弃用,因为新的 Blaze 引擎会自动隔离 DOM,不再需要手动隔离它.
{{#isolate}}
and {{#constant}}
have been deprecated since the new Blaze engine isolates DOM automatically and no longer requires it to be manually isolated.
这篇关于流星.防止模板重新渲染或禁用反应性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!