Merge pull request #725 from RickCole21/master

scoped中close逻辑优化下
This commit is contained in:
liaoxuezhi 2020-06-30 09:25:32 +08:00 committed by GitHub
commit b4819a7a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -168,16 +168,17 @@ function createScopedTools(
*
* @param target name
*/
close(target: string) {
close(target: string | boolean) {
const scoped = this;
let targets =
typeof target === 'string' ? target.split(/\s*,\s*/) : target;
// 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
targets
.map(name => scoped.getComponentByName(name))
.filter(component => component && component.props.show)
.forEach(closeDialog);
if (typeof target === 'string') {
// 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
target
.split(/\s*,\s*/)
.map(name => scoped.getComponentByName(name))
.filter(component => component && component.props.show)
.forEach(closeDialog);
}
}
};
}