流星表单事件没有通信
Meteor form event no communication
我正在玩流星教程,我注意到我无法从表单提交事件获得任何反馈;会话变量没有被设置为12,我没有得到任何打印到浏览器中的控制台(我使用Chrome)。然而,我确实得到反馈从hello点击按钮事件的日志和会话变量的变化。
if (Meteor.isClient) {
// counter starts at 0
Session.setDefault('counter', 0);
Session.setDefault('data', 0);
Template.hello.helpers({
counter: function () {
return Session.get('counter');
}
});
Template.hello.events({
'click button': function (event) {
// increment the counter when button is clicked
console.log("Button Clicked");
console.log(event.type);
Session.set('counter', Session.get('counter') + 1 );
}
});
Template.form.events({
'sumbit form': function (event) {
event.preventDefault();
console.log("Form submitted");
console.log(event.type);
Session.set('data', 12);
}
});
Template.results.helpers({
result: function () {
return Session.get('data');
}});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup });
}
这是html。
<head>
<title>simple-todos</title>
</head>
<body>
<h1>Welcome to my First Meteor App</h1>
{{ >form }}
{{ >results }}
{{ >hello }}
</body>
<template name="hello">
<button>Click Me</button>
<p>You've pressed the button {{counter}} times.</p>
</template>
<template name="form">
<form >
<input type="text" name = "info" placeholder="" />
</form>
</template>
<template name="results">
<p> {{ result }} </p>
</template>
可能是这个错误类型?
Template.form.events({
'submit form': function (event) {
...
}
});
相关文章:
- 分派点击事件并保留击键修饰符
- 模糊事件的Javascript测试
- keyup事件处理程序更改焦点不适用于快速键入
- 使用 jQuery 的 .on 函数如何获取事件的原始元素
- Angularjs事件与发布/订阅指令之间的通信
- Socket.IO:如何在同一服务器中的Socket.on()事件之间通信/交换数据
- 基于事件的IPC(使用事件的portlet间通信)
- 角度模块中的全局通信:事件总线或调解器模式/服务
- 服务和指令之间的通信:依赖关系或或事件
- 服务器和浏览器之间基于事件的Ajax通信
- 控制器之间的通信没有事件
- 如何设置Websocket与客户端和服务器发送事件服务器通信
- 流星d3.js通信事件
- 事件没有触发,React组件之间的通信问题
- c#程序中与/触发事件通信的网页
- 当react或vjs中的组件之间进行通信时,使用回调和使用事件有什么不同?
- 在React.js中,我如何设置一个简单的全局事件系统来在组件之间进行通信?
- 使用事件在视图设计模式之间进行通信
- 是否可以在浏览器窗口之间进行基于事件的通信
- 流星表单事件没有通信