UNPKG

1.11 kBJavaScriptView Raw
1import{r as t,c as i,h as s,g as e}from"./p-059912fd.js";let h=class{constructor(s){t(this,s),this.onChange=i(this,"change",7),this.type="switch",this.checked=!1,this.color="#04BE02",this.disabled=!1,this.nativeProps={},this.isWillLoadCalled=!1,this.switchChange=t=>{t.stopPropagation();const i=t.target.checked;this.isChecked=i,this.onChange.emit({value:i})}}function(t,i){this.isWillLoadCalled&&t!==i&&(this.isChecked=t)}componentWillLoad(){this.isWillLoadCalled=!0,this.isChecked=this.checked}componentDidLoad(){Object.defineProperty(this.el,"value",{get:()=>this.isChecked,configurable:!0})}render(){const{type:t,color:i,isChecked:e,name:h,disabled:c,nativeProps:o}=this;return s("input",Object.assign({type:"checkbox",class:`weui-${t}`,style:e?{borderColor:i||"04BE02",backgroundColor:i||"04BE02"}:{},checked:e,name:h,disabled:c,onChange:this.switchChange},o))}get el(){return e(this)}static get watchers(){return{checked:["function"]}}};h.style="taro-switch-core{display:inline-block;width:52px;height:32px}taro-switch-core .weui-switch{display:block;width:100%;height:100%}";export{h as taro_switch_core}
\No newline at end of file