Element-ui 对话框el-dialog close关闭的回调 点击其他按钮关闭el-dialog时均调用close方法

Bertha 。 2022-08-30 14:55 234阅读 0赞

点击确定或取消按钮关闭窗口,则触发close关闭回调事件,调用refreshData方法。一定要避免重复调用!!

  1. <el-button type="text" @click="centerDialogVisible = true" @close="refreshData">点击打开 Dialog</el-button>
  2. <el-dialog
  3. title="提示"
  4. :visible.sync="centerDialogVisible"
  5. width="30%"
  6. center>
  7. <span>需要注意的是内容是默认不居中的</span>
  8. <span slot="footer" class="dialog-footer">
  9. <el-button @click="centerDialogVisible = false">取 消</el-button>
  10. <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
  11. </span>
  12. </el-dialog>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. centerDialogVisible: false
  18. };
  19. },
  20. methods: {
  21. refreshData() {
  22. console.log(1)
  23. }
  24. }
  25. }
  26. </script>

发表评论

表情:
评论列表 (有 0 条评论,234人围观)

还没有评论,来说两句吧...

相关阅读