UNPKG

1.54 kBJavaScriptView Raw
1System.register(["./p-b2d01686.system.js"],(function(e){"use strict";var t,i,n,o;return{setters:[function(e){t=e.r;i=e.c;n=e.h;o=e.g}],execute:function(){var r="taro-switch-core{display:inline-block;width:52px;height:32px}taro-switch-core .weui-switch{display:block;width:100%;height:100%}";var s=e("taro_switch_core",function(){function e(e){var n=this;t(this,e);this.onChange=i(this,"change",7);this.type="switch";this.checked=false;this.color="#04BE02";this.disabled=false;this.nativeProps={};this.isWillLoadCalled=false;this.switchChange=function(e){e.stopPropagation();var t=e.target.checked;n.isChecked=t;n.onChange.emit({value:t})}}e.prototype.function=function(e,t){if(!this.isWillLoadCalled)return;if(e!==t)this.isChecked=e};e.prototype.componentWillLoad=function(){this.isWillLoadCalled=true;this.isChecked=this.checked};e.prototype.componentDidLoad=function(){var e=this;Object.defineProperty(this.el,"value",{get:function(){return e.isChecked},configurable:true})};e.prototype.render=function(){var e=this,t=e.type,i=e.color,o=e.isChecked,r=e.name,s=e.disabled,c=e.nativeProps;var a=o?{borderColor:i||"04BE02",backgroundColor:i||"04BE02"}:{};return n("input",Object.assign({type:"checkbox",class:"weui-"+t,style:a,checked:o,name:r,disabled:s,onChange:this.switchChange},c))};Object.defineProperty(e.prototype,"el",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checked:["function"]}},enumerable:false,configurable:true});return e}());s.style=r}}}));
\No newline at end of file