判断逻辑优化一下
This commit is contained in:
parent
3981ab9f8d
commit
5c3b8888f5
|
@ -168,16 +168,17 @@ function createScopedTools(
|
||||||
*
|
*
|
||||||
* @param target 目标 name
|
* @param target 目标 name
|
||||||
*/
|
*/
|
||||||
close(target: string) {
|
close(target: string | boolean) {
|
||||||
const scoped = this;
|
const scoped = this;
|
||||||
let targets =
|
let targets =
|
||||||
typeof target === 'string' ? target.split(/\s*,\s*/) : target;
|
typeof target === 'string' ? target.split(/\s*,\s*/) : target;
|
||||||
|
|
||||||
// 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
|
// 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
|
||||||
targets
|
Array.isArray(targets) &&
|
||||||
.map(name => scoped.getComponentByName(name))
|
targets
|
||||||
.filter(component => component && component.props.show)
|
.map(name => scoped.getComponentByName(name))
|
||||||
.forEach(closeDialog);
|
.filter(component => component && component.props.show)
|
||||||
|
.forEach(closeDialog);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue