mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(RadioGroup): disabled prop not work (#4242)
This commit is contained in:
parent
f172842c02
commit
2489ba2b79
@ -52,7 +52,7 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
|
||||
const { target } = event;
|
||||
const labelClicked = label && (label === target || label.contains(target));
|
||||
|
||||
if (!this.disabled && !(labelClicked && this.labelDisabled)) {
|
||||
if (!this.isDisabled && !(labelClicked && this.labelDisabled)) {
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
|
@ -43,3 +43,34 @@ test('radio-group change', () => {
|
||||
labels.at(3).trigger('click');
|
||||
expect(wrapper.vm.result).toEqual('b');
|
||||
});
|
||||
|
||||
test('radio group disabled', () => {
|
||||
const wrapper = mount({
|
||||
template: `
|
||||
<radio-group v-model="result" disabled @change="$emit('change', $event)">
|
||||
<radio
|
||||
v-for="item in list"
|
||||
:key="item"
|
||||
:name="item"
|
||||
>
|
||||
label
|
||||
</radio>
|
||||
</radio-group>
|
||||
`,
|
||||
components: {
|
||||
Radio,
|
||||
RadioGroup
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
result: 'a',
|
||||
list: ['a', 'b', 'c', 'd']
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
const icons = wrapper.findAll('.van-radio__icon');
|
||||
icons.at(2).trigger('click');
|
||||
|
||||
expect(wrapper.emitted('change')).toBeFalsy();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user