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