mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-23 09:52:57 +08:00
chore(Checkbox): remove checked setter
This commit is contained in:
parent
9e9f0e3d4d
commit
9aabb42f9d
@ -46,24 +46,19 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const checked = computed({
|
const checked = computed(() => {
|
||||||
get() {
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
return parent.props.modelValue.indexOf(props.name) !== -1;
|
return parent.props.modelValue.indexOf(props.name) !== -1;
|
||||||
}
|
}
|
||||||
return props.modelValue;
|
return props.modelValue;
|
||||||
},
|
|
||||||
set(value) {
|
|
||||||
if (parent) {
|
|
||||||
setParentValue(value);
|
|
||||||
} else {
|
|
||||||
emit('update:modelValue', value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const toggle = (newValue = !checked.value) => {
|
const toggle = (newValue = !checked.value) => {
|
||||||
checked.value = newValue;
|
if (parent) {
|
||||||
|
setParentValue(newValue);
|
||||||
|
} else {
|
||||||
|
emit('update:modelValue', newValue);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
@ -157,7 +157,6 @@ export default createComponent({
|
|||||||
if (slots.default) {
|
if (slots.default) {
|
||||||
return slots.default();
|
return slots.default();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.text) {
|
if (props.text) {
|
||||||
return <div class={bem('text')}>{props.text}</div>;
|
return <div class={bem('text')}>{props.text}</div>;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user