【发布时间】:2014-06-04 23:12:06
【问题描述】:
所以我做了一些超级简单的东西来测试 Meteor 中的反应性,但是当我开始制作服务器和客户端文件夹时,反应性中断了。我无法再手动编辑数据库并立即在浏览器中查看更改。
模板:
<template name="hello">
<input type="button" value="Click" />
{{#each tt}}
{{test}}
{{/each}}
</template>
客户端/test.js:
Template.hello.events(
{
'click input': function ()
{
Meteor.call('set');
}
});
Template.hello.helpers(
{
tt: function()
{
Meteor.call('get', function(error, result)
{
Session.set('aa', result);
});
return Session.get('aa');
}
});
服务器/testS.js:
Test = new Meteor.Collection("test");
Meteor.methods(
{
set: function()
{
Test.insert({test: "test 1"});
},
get: function()
{
return Test.find().fetch();
}
});
使用此文件夹结构获得响应性我缺少什么?
【问题讨论】:
标签: meteor