Element ui 取消弹出框点击其他位置关闭的方法

 

:close-on-click-modal="false"

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是用 Element UI 实现退回弹出的示例代码: ```html <template> <div> <el-button type="danger" @click="showDialog">退回</el-button> <el-dialog title="退回原因" :visible.sync="dialogVisible" :before-close="handleClose" > <el-form ref="form" :model="form" label-width="80px"> <el-form-item label="退回原因" prop="reason"> <el-input type="textarea" v-model="form.reason"></el-input> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="dialogVisible = false">取消</el-button> <el-button type="primary" @click="handleReturn">确定</el-button> </div> </el-dialog> </div> </template> <script> export default { data() { return { dialogVisible: false, form: { reason: "", }, }; }, methods: { showDialog() { this.dialogVisible = true; }, handleClose(done) { this.$confirm("确定关闭吗?") .then(() => { done(); }) .catch(() => {}); }, handleReturn() { this.$emit("return", this.form.reason); this.dialogVisible = false; }, }, }; </script> ``` 在上面的代码中,我们使用了 `el-dialog` 组件来创建退回弹出,使用了 `el-form` 组件来创建表单,使用了 `el-input` 组件来创建多行文本,使用了 `el-button` 组件来创建按钮,使用了 `slot` 来自定义弹出的底部按钮。在弹出关闭前,使用了 `before-close` 事件来弹出确认提示,确保用户不会误操作。在点击弹出的确定按钮后,使用了 `$emit` 方法来触发 `return` 事件,并将用户输入的退回原因作为参数传递给父组件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值