Skip to content

The onOk function of Modal.confirm cannot control the loading state of the ok button #4551

@YingJian-hu

Description

@YingJian-hu
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.7.3

Environment

vue: 2.x, browser: chrome: 92.0.4515.159

Reproduction link

https://github.com/vueComponent/ant-design-vue/issues?q=onOk

Steps to reproduce

const _this = this
this.$confirm({
okButtonProps: {
props: {
loading: _this.confirmLoading
}
},
onOk() {
_this.confirmLoading = true
setTimeout(() => { _this.confirmLoading=false }, 3000)
}
})

What is expected?

点击Confirm框的确定按钮时,确定按钮的loading更新为true,然后3秒后更新为false

What is actually happening?

确定按钮的loading属性一直为false


我不清楚是我使用方式的问题,还是程序的问题,我想要在Modal.confirm中,在onOK回调函数里控制ok按钮的loading状态要怎么做呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions