element-ui MessageBox 弹框自定义内容,点击取消时控制台报错

在这里插入图片描述
解决:加上.catch(()=>{ })

this.$msgbox({
                title: '消息',
                message: h('p', null, '是否同意张三的500元提现申请?'),
                showCancelButton: true,
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                beforeClose: (action, instance, done) => {
                    if (action === 'confirm') {
                        instance.confirmButtonLoading = true;
                        instance.confirmButtonText = '执行中...';
                        setTimeout(() => {
                            done();
                            setTimeout(() => {
                                instance.confirmButtonLoading = false;
                            }, 300);
                        }, 3000);
                    } else {
                        done();
                    }
                },
            }).then(action => {
                this.$message({
                    type: 'info',
                    message: 'action: ' + action,
                });
            }).catch(()=>{
                
            });

你可能感兴趣的:(element-ui,项目经验)