Polymer 1.0 自定义事件
Polymer 1.0 custom events
我在 Polymer 0.5 上使用此代码,但在 Polymer 1.0 上它不起作用。
在子元素上:
this.fire('login-start', {
username: this.username,
password: this.password,
me: this
});
在父元素 (app-main.html) 上:
<dom-module name="app-main" on-login-start="{{checkLogin}}">
在应用程序上-main.js:
checkLogin: function() {
alert("This is not working.");
}
如何在 Polymer 1.0 中触发和捕获自定义事件?
您应该从登录开始时删除双括号 ({{}})
。
<dom-module name="app-main" on-login-start="checkLogin">
Here 是文档。
我在 Polymer 0.5 上使用此代码,但在 Polymer 1.0 上它不起作用。
在子元素上:
this.fire('login-start', {
username: this.username,
password: this.password,
me: this
});
在父元素 (app-main.html) 上:
<dom-module name="app-main" on-login-start="{{checkLogin}}">
在应用程序上-main.js:
checkLogin: function() {
alert("This is not working.");
}
如何在 Polymer 1.0 中触发和捕获自定义事件?
您应该从登录开始时删除双括号 ({{}})
。
<dom-module name="app-main" on-login-start="checkLogin">
Here 是文档。