ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.13k stars 14.64k forks source link

[Bug Report] prompt 如何在 beforeClose 里调用文本框的值? #22273

Open flystarme opened 1 year ago

flystarme commented 1 year ago

Element UI version

2.15.12

OS/Browsers version

nothing

Vue version

2.7.14

Reproduction Link

https://elementui.github.io/issue-generator/#/zh-CN

Steps to reproduce

this.$prompt('输入一个邮件地址', '邮件测试', {

                confirmButtonText: '发送一封测试邮件',
                cancelButtonText: '取消',
                inputErrorMessage: '邮箱格式不正确',
                beforeClose: (action, instance, done) => {
                    if (action == 'confirm'){
                        instance.confirmButtonLoading = true;
                        instance.confirmButtonText = '测试邮件发送中...';
                        //这里如何调用到文本框的内容?
                        //axios....
                        instance.confirmButtonLoading = false;

                    }else{
                        done()
                    }
                }
            }).then(({value}) => {
                //或者这里如何使用instance.confirmButtonLoading = true;
            }).catch(() => {});

What is Expected?

在beforeClose里可以调用到文本框的内容,或者在then后使用confirmButtonLoading

What is actually happening?

在beforeClose里可以无法调用到文本框的内容,在then后无法使用confirmButtonLoading

flystarme commented 1 year ago

instance.$refs.input.value 可以在beforeclose里获取到文本框的值