feat(Checkbox): add bind-group prop (#4600)

This commit is contained in:
neverland
2019-09-27 12:49:09 +08:00
committed by GitHub
parent 0face945c9
commit f97b2bc7a5
5 changed files with 42 additions and 0 deletions
+8
View File
@@ -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;
},
+8
View File
@@ -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];
},