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: {
|
||||
updateModel (update) {
|
||||
this.childrens = findComponentsDownward(this, 'Checkbox');
|
||||
this.childrens = findComponentsDownward(this, 'Checkbox', 'CheckboxGroup');
|
||||
if (this.childrens) {
|
||||
const { value } = this;
|
||||
this.childrens.forEach(child => {
|
||||
|
|
|
@ -235,9 +235,11 @@
|
|||
},
|
||||
handleLeftCheckedKeysChange (keys) {
|
||||
this.leftCheckedKeys = keys;
|
||||
this.handleCheckedKeys();
|
||||
},
|
||||
handleRightCheckedKeysChange (keys) {
|
||||
this.rightCheckedKeys = keys;
|
||||
this.handleCheckedKeys();
|
||||
},
|
||||
handleCheckedKeys () {
|
||||
const sourceSelectedKeys = this.getValidKeys('left');
|
||||
|
|
|
@ -212,11 +212,18 @@ export function findComponentDownward (context, componentName) {
|
|||
}
|
||||
|
||||
// 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) => {
|
||||
if (child.$options.name === componentName) components.push(child);
|
||||
const foundChilds = findComponentsDownward(child, componentName);
|
||||
return components.concat(foundChilds);
|
||||
if (ignoreComponentNames.indexOf(child.$options.name) < 0) {
|
||||
const foundChilds = findComponentsDownward(child, componentName);
|
||||
return components.concat(foundChilds);
|
||||
} else {
|
||||
return components
|
||||
}
|
||||
}, []);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue