更新时间:2023-10-05 23:15:46
创建一个表示登录组件中的状态,并设置 notify:true
。
在登录组件和使用该状态的任何其他组件中使用数据绑定。
Create a property that represents the status in your login component and set notify: true
.
Use data-binding in your login component and any other components that use that status.
<login-component status="{{status}}"></login-component>
<other-component login="{{status}}"></other-component>
如果您使用聚合物模板之外的组件,请使用自动绑定, code>< template is =dom-bind> 。
If you use your components outside of a Polymer template, make use of autobind by wrapping them in a <template is="dom-bind">
.
<template is="dom-bind">
<login-component status="{{status}}"></login-component>
<other-component login="{{status}}"></other-component>
</template>