feat(Checkbox): add bind-group prop (#4600)
This commit is contained in:
@@ -19,10 +19,18 @@ export const CheckboxMixin = ({ parent, bem, role }) => ({
|
||||
shape: {
|
||||
type: String,
|
||||
default: 'round'
|
||||
},
|
||||
bindGroup: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
disableBindRelation() {
|
||||
return !this.bindGroup;
|
||||
},
|
||||
|
||||
isDisabled() {
|
||||
return (this.parent && this.parent.disabled) || this.disabled;
|
||||
},
|
||||
|
||||
@@ -21,6 +21,10 @@ function flattenVNodes(vnodes: VNode[]) {
|
||||
return result;
|
||||
}
|
||||
|
||||
type ChildrenMixinThis = {
|
||||
disableBindRelation?: boolean;
|
||||
};
|
||||
|
||||
export function ChildrenMixin(parent: string, options: ChildrenMixinOptions = {}) {
|
||||
const indexKey = options.indexKey || 'index';
|
||||
|
||||
@@ -33,6 +37,10 @@ export function ChildrenMixin(parent: string, options: ChildrenMixinOptions = {}
|
||||
|
||||
computed: {
|
||||
parent() {
|
||||
if ((this as ChildrenMixinThis).disableBindRelation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (this as any)[parent];
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user