|
|
@ -1,11 +1,13 @@ |
|
|
|
<template> |
|
|
|
<el-form-item> |
|
|
|
<div class="switchWrap"> |
|
|
|
<span :class="['switchDesc',{'fl':float =='left'},{'fr':float =='right'}]" v-if="activeText || inactiveText">{{ internalValue ? activeText : inactiveText |
|
|
|
<span :class="['switchDesc',{'fl':float =='left'},{'fr':float =='right'}]" v-if="activeText || inactiveText"> |
|
|
|
{{ internalValue === activeValue ? activeText : inactiveText |
|
|
|
}}</span> |
|
|
|
|
|
|
|
<el-switch v-model="internalValue" :active-color="activeColor" :inactive-color="inactiveColor" v-bind="$attrs" |
|
|
|
:disabled="disabled || loading" @change="handleChange"> |
|
|
|
:disabled="disabled || loading" :active-value="activeValue" |
|
|
|
:inactive-value="inactiveValue" @change="handleChange"> |
|
|
|
<!-- 自定义开启时的图标 --> |
|
|
|
<template #active-icon> |
|
|
|
</template> |
|
|
@ -39,6 +41,14 @@ export default { |
|
|
|
type: [Boolean,String,Number], |
|
|
|
default: false, |
|
|
|
}, |
|
|
|
activeValue: { |
|
|
|
type: [Boolean,String,Number], |
|
|
|
default: '', |
|
|
|
}, |
|
|
|
inactiveValue: { |
|
|
|
type: [Boolean,String,Number], |
|
|
|
default: '', |
|
|
|
}, |
|
|
|
activeColor: { |
|
|
|
type: String, |
|
|
|
default: '#00C261', |
|
|
|