修改my-switch组件禁止时透明度变化为可控
This commit is contained in:
parent
b5eb099c75
commit
77b9ed369a
|
|
@ -6,7 +6,7 @@
|
||||||
height: height,
|
height: height,
|
||||||
borderRadius: `calc(${height} / 2)`,
|
borderRadius: `calc(${height} / 2)`,
|
||||||
}" @click.stop="changeSwitch"
|
}" @click.stop="changeSwitch"
|
||||||
:class="{disabled:disabled}"
|
:class="{disabled:disabled&&openDisabledClass}"
|
||||||
>
|
>
|
||||||
<view v-show="!modelValue" class="before" :style="{
|
<view v-show="!modelValue" class="before" :style="{
|
||||||
left: `calc(${margin} * 2)`,
|
left: `calc(${margin} * 2)`,
|
||||||
|
|
@ -40,6 +40,10 @@
|
||||||
type:Boolean,
|
type:Boolean,
|
||||||
default:false
|
default:false
|
||||||
},
|
},
|
||||||
|
openDisabledClass:{
|
||||||
|
type:Boolean,
|
||||||
|
default:true
|
||||||
|
},
|
||||||
height: {
|
height: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '40rpx',
|
default: '40rpx',
|
||||||
|
|
@ -82,10 +86,11 @@
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const emits = defineEmits(['update:modelValue', 'change'])
|
const emits = defineEmits(['update:modelValue', 'change','click'])
|
||||||
// 修改switch值
|
// 修改switch值
|
||||||
function changeSwitch() {
|
function changeSwitch() {
|
||||||
if(props.disabled){
|
if(props.disabled){
|
||||||
|
emits('click')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let currentVal=props.modelValue
|
let currentVal=props.modelValue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue