UNPKG

vue-ui-wl

Version:

vue component

2 lines 4.6 kB
webpackJsonp([3],{104:function(t,e){},108:function(t,e){},122:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={props:{width:{type:[String,Number],default:60},height:{type:[String,Number],default:22},turnH:{type:[String,Number],default:12},onText:{type:String,default:""},offText:{type:String,default:""},onColor:{type:String,default:"#34a853"},offColor:{type:String,default:"#e66d72"},value:{type:Boolean,default:!0},name:{type:String,default:""}},data:function(){return{showText:this.value?this.onText:this.offText,bg:this.value?this.onColor:this.offColor,switchVal:this.value}},watch:{switchVal:function(t){this.showText=t?this.onText:this.offText,this.bg=t?this.onColor:this.offColor,this.$emit("switch-change",t)}}}},136:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(39),a=function(t){return t&&t.__esModule?t:{default:t}}(n);e.default={components:{Switchs:a.default},data:function(){return{value:!0}},methods:{switchChange:function(t){console.log("值为",t)}}}},150:function(t,e,o){t.exports=o(24)},2:function(t,e,o){o(4);var n=o(0)(o(6),o(3),"data-v-12f6e127",null);t.exports=n.exports},24:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}var a=o(1),s=n(a),i=o(53),r=n(i),l=o(5),u=n(l);s.default.config.productionTip=!1,new s.default({el:"#switchs",router:u.default,template:"<Switchs/>",components:{Switchs:r.default}})},3:function(t,e){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div")},staticRenderFns:[]}},39:function(t,e,o){o(108);var n=o(0)(o(122),o(79),"data-v-c0ca2358",null);t.exports=n.exports},4:function(t,e){},5:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var a=o(1),s=n(a),i=o(7),r=n(i),l=o(2),u=n(l);s.default.use(r.default),e.default=new r.default({routes:[{path:"/",name:"Index",component:u.default}]})},53:function(t,e,o){o(104);var n=o(0)(o(136),o(75),"data-v-9924d3d4",null);t.exports=n.exports},6:function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={}},75:function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"content"},[o("div",[o("switchs",{attrs:{value:t.value,name:"first","on-text":"on","off-text":"off","on-color":"green","off-color":"red"},on:{"switch-change":t.switchChange}}),t._v(" "),o("switchs",{attrs:{value:t.value,"on-text":"on","off-text":"off","on-color":"blue","off-color":"gold"}}),t._v(" "),o("switchs",{attrs:{value:t.value,"on-text":"on","off-text":"off","on-color":"pink","off-color":"purple"}}),t._v(" "),o("switchs",{attrs:{value:t.value,"on-text":"on","off-text":"off"}})],1),t._v(" "),o("div",[o("switchs",{attrs:{width:"60",height:"30",value:t.value,name:"first","on-text":"on","off-text":"off","on-color":"green","off-color":"red"},on:{"switch-change":t.switchChange}}),t._v(" "),o("switchs",{attrs:{width:"60",height:"30",value:t.value,"on-text":"on","off-text":"off","on-color":"blue","off-color":"gold"}}),t._v(" "),o("switchs",{attrs:{width:"60",height:"30",value:t.value,"on-text":"on","off-text":"off","on-color":"pink","off-color":"purple"}}),t._v(" "),o("switchs",{attrs:{width:"70",height:"30","turn-h":"20",value:t.value,"on-text":"on","off-text":"off"}})],1)])},staticRenderFns:[]}},79:function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("label",{staticClass:"switch",style:{"background-color":this.bg,width:t.width+"px",height:t.height+"px","border-radius":t.height/2+"px"}},[o("input",{directives:[{name:"model",rawName:"v-model",value:t.switchVal,expression:"switchVal"}],staticStyle:{display:"none"},attrs:{type:"checkbox",name:t.name},domProps:{value:t.value,checked:Array.isArray(t.switchVal)?t._i(t.switchVal,t.value)>-1:t.switchVal},on:{change:function(e){var o=t.switchVal,n=e.target,a=!!n.checked;if(Array.isArray(o)){var s=t.value,i=t._i(o,s);n.checked?i<0&&(t.switchVal=o.concat([s])):i>-1&&(t.switchVal=o.slice(0,i).concat(o.slice(i+1)))}else t.switchVal=a}}}),t._v(" "),o("span",{staticClass:"pan",class:t.switchVal?"left10":"right10",style:{"line-height":t.height-2+"px","font-size":parseInt(t.turnH,10)+2+"px"}},[t._v(t._s(t.showText))]),t._v(" "),o("span",{staticClass:"turn",style:{width:t.turnH+"px",height:t.turnH+"px","border-radius":t.turnH/2+"px",top:(t.height-t.turnH-2)/2+"px",left:t.switchVal?Number(t.width)-Number(t.turnH)-5+"px":"5px"}})])},staticRenderFns:[]}}},[150]); //# sourceMappingURL=switchs.89efef204e604707f2bd.js.map