我在服务器端定义了一个Meteor.method(在/ server中的.js中),我可以从客户端模板脚本调用它(使用回调).我想做类似的事情,但希望这一切都是客户端,所以我将方法移动到客户端脚本,但结果返回为'undefined'.
Template.showDialog.events({
'click #clickme' : function() {
Meteor.call('foo', 'ola', function(error, result) {
alert('here');
alert(result);
});
}
});
Meteor.methods({
foo: function (myarg) {
return myarg+'CLI';
}
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2201 次 |
最近记录: |