agriculture-ui
Version:
农业开发组件库
1 lines • 2.61 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.mui=e():t.mui=e()}(self,(function(){return function(){"use strict";var t={486:function(t,e,o){function n(t,e,o,n,i,r,s,a){var c,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=o,l._compiled=!0),n&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),s?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=c):i&&(c=a?function(){i.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:i),c)if(l.functional){l._injectStyles=c;var u=l.render;l.render=function(t,e){return c.call(e),u(t,e)}}else{var f=l.beforeCreate;l.beforeCreate=f?[].concat(f,c):[c]}return{exports:t,options:l}}o.d(e,{A:function(){return n}})}},e={};function o(n){var i=e[n];if(void 0!==i)return i.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,o),r.exports}o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){o.r(n),o.d(n,{default:function(){return r}});var t=function(){var t=this,e=t._self._c;return e("div",{staticClass:"ag-switch",class:{"is-checked":t.value},on:{click:t.handleClick}},[e("span",{ref:"core",staticClass:"ag-switch_core"},[e("span",{staticClass:"ag-switch_button"})]),t._v(" "),e("input",{ref:"input",staticClass:"ag-switch_input",attrs:{type:"checkbox",name:t.name}})])};t._withStripped=!0;var e={name:"agSwitch",props:{value:{type:Boolean,default:!1},activeColor:{type:String,default:""},inactiveColor:{type:String,default:""},name:{type:String,default:""}},methods:{handleClick(){this.$emit("input",!this.value),this.$nextTick((()=>{this.setColor()})),this.$refs.input.checked=this.value},setColor(){if(this.activeColor||this.inactiveColor){let t=this.value?this.activeColor:this.inactiveColor;this.$refs.core.style.borderColor=t,this.$refs.core.style.backgroundColor=t}}},mounted(){this.setColor(),this.$refs.input.checked=this.value}},i=(0,o(486).A)(e,t,[],!1,null,"27d682be",null).exports;i.install=function(t){t.component(i.name,i)};var r=i}(),n}()}));