Merge branch '2.0' of https://github.com/iview/iview into 2.0
This commit is contained in:
commit
88f40c57a6
3 changed files with 13 additions and 4 deletions
|
@ -49,7 +49,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
updateModel (update) {
|
updateModel (update) {
|
||||||
this.childrens = findComponentsDownward(this, 'Checkbox');
|
this.childrens = findComponentsDownward(this, 'Checkbox', 'CheckboxGroup');
|
||||||
if (this.childrens) {
|
if (this.childrens) {
|
||||||
const { value } = this;
|
const { value } = this;
|
||||||
this.childrens.forEach(child => {
|
this.childrens.forEach(child => {
|
||||||
|
|
|
@ -235,9 +235,11 @@
|
||||||
},
|
},
|
||||||
handleLeftCheckedKeysChange (keys) {
|
handleLeftCheckedKeysChange (keys) {
|
||||||
this.leftCheckedKeys = keys;
|
this.leftCheckedKeys = keys;
|
||||||
|
this.handleCheckedKeys();
|
||||||
},
|
},
|
||||||
handleRightCheckedKeysChange (keys) {
|
handleRightCheckedKeysChange (keys) {
|
||||||
this.rightCheckedKeys = keys;
|
this.rightCheckedKeys = keys;
|
||||||
|
this.handleCheckedKeys();
|
||||||
},
|
},
|
||||||
handleCheckedKeys () {
|
handleCheckedKeys () {
|
||||||
const sourceSelectedKeys = this.getValidKeys('left');
|
const sourceSelectedKeys = this.getValidKeys('left');
|
||||||
|
|
|
@ -212,11 +212,18 @@ export function findComponentDownward (context, componentName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find components downward
|
// Find components downward
|
||||||
export function findComponentsDownward (context, componentName) {
|
export function findComponentsDownward (context, componentName, ignoreComponentNames = []) {
|
||||||
|
if (!Array.isArray(ignoreComponentNames)) {
|
||||||
|
ignoreComponentNames = [ignoreComponentNames]
|
||||||
|
}
|
||||||
return context.$children.reduce((components, child) => {
|
return context.$children.reduce((components, child) => {
|
||||||
if (child.$options.name === componentName) components.push(child);
|
if (child.$options.name === componentName) components.push(child);
|
||||||
const foundChilds = findComponentsDownward(child, componentName);
|
if (ignoreComponentNames.indexOf(child.$options.name) < 0) {
|
||||||
return components.concat(foundChilds);
|
const foundChilds = findComponentsDownward(child, componentName);
|
||||||
|
return components.concat(foundChilds);
|
||||||
|
} else {
|
||||||
|
return components
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue