html <dom-module id="custom-button"> <template> <style> </style> </template> <script> </script> </dom-module> script const CustomButtonMixin = (superclass) => class extends superclass { static get properties() { return { disabled: { type: Boolean, value: false, reflectToAttribute: true } }; } toggle() { this.disabled = !this.disabled; } }; script class CustomButton extends CustomButtonMixin(Polymer.Element) { static get is() { return 'custom-button'; } } customElements.define(CustomButton.is, CustomButton); html <custom-button></custom-button>


上一篇:
下一篇:
切换中文