0
我构建了一个在移动设备上呈现主题列表的响应式论坛演示。收集更新时,它没有反应。我认为原因是缓慢的查询。在minimongo中查询性能
我测试的HTML:
<template name="index">
<h1 id="myTime"></h1>
{{#each foo}}
<h1>{{name}}</h1>
{{/each}}
<input id="t" type="text"></input>
<button id="s">submit</button>
</template>
和JS:
Template.index.foo = function() {
return Foo.find({}).fetch();
};
Template.index.events({
"click #s": function() {
Foo.insert({name: $("#t").val()});
}
});
Meteor.startup(function() {
Meteor.setInterval(function() {
$("#myTime").text((new Date()).getTime());
}, 1);
});
当文件的数量非常少,代码工作非常快。当文件数量大于300时,渲染将停止约3秒
是否有可能改进它? :)
谢谢!我没有DOM操作代码。所有DOM操作都由模板处理。延迟在'Template.index.rendered'之前(我在渲染函数中添加了一个'alert',并在延迟之后提醒) – QingYun 2013-05-08 16:11:27