mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
[new feature] Checkbox: support config the maximum amount of checked options (#631)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class="van-checkbox"
|
||||
:class="[
|
||||
`van-checkbox--${shape}`,
|
||||
{ 'van-checkbox--disabled': isDisabled }
|
||||
{ 'van-checkbox--disabled': isDisabled || isLimit }
|
||||
]"
|
||||
>
|
||||
<span class="van-checkbox__input">
|
||||
@@ -90,7 +90,12 @@ export default create({
|
||||
},
|
||||
|
||||
isDisabled() {
|
||||
return (this.isGroup && this.parentGroup && this.parentGroup.disabled) || this.disabled;
|
||||
return (this.isGroup && this.parentGroup && this.parentGroup.disabled) || this.disabled ||
|
||||
(this.isGroup && this.parentGroup && this.parentGroup.max > 0 && this.parentGroup.max <= this.parentGroup.value.length && !this.isChecked);
|
||||
},
|
||||
|
||||
isLimit() {
|
||||
return this.isGroup && this.parentGroup && this.parentGroup.max > 0 && this.parentGroup.max <= this.parentGroup.value.length;
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user