Browse Source

修改switch组件文案显示不正确

pull/72/head
zq 4 days ago
parent
commit
0875b26b52
  1. 14
      src/components/GuipSwitch.vue

14
src/components/GuipSwitch.vue

@ -1,11 +1,13 @@
<template> <template>
<el-form-item> <el-form-item>
<div class="switchWrap"> <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> }}</span>
<el-switch v-model="internalValue" :active-color="activeColor" :inactive-color="inactiveColor" v-bind="$attrs" <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 #active-icon>
</template> </template>
@ -39,6 +41,14 @@ export default {
type: [Boolean,String,Number], type: [Boolean,String,Number],
default: false, default: false,
}, },
activeValue: {
type: [Boolean,String,Number],
default: '',
},
inactiveValue: {
type: [Boolean,String,Number],
default: '',
},
activeColor: { activeColor: {
type: String, type: String,
default: '#00C261', default: '#00C261',

Loading…
Cancel
Save