ElemeFE / ElemeFE/element

[Feature Request] 增加组件回执方法的同步特性

Open
#21,881 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Existing Component

### Component Name
所有组件

### Description
情景:
第一个组件回执方法的返回值决定第一个组件是否继续继续运行,第一组件回执方法默认回执true
第二组件在第一组件的回执方法中,通过第二组件的回执方法的返回值,来确定第一组件是否继续运行
问题:
第二组件的回执方法属于异步方法,当需执行第二组件的回执方法时,程序会自动跳过回执方法的执行,致使第一组件直接返回了默认值true
代码:
beforeUpload() {//上传组件,上传前拦截方法,无return时默认为true
if(this.list.entityList.length>0) {
this.$confirm('上传将清除已上传项目,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if(action == 'confirm') return true
else {
this.$message({
type: 'info',
message: '已取消上传'
});
return false
}
}
})
}
},

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.