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

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

<el-button type="text" @click="centerDialogVisible = true" @close="refreshData">点击打开 Dialog</el-button>

<el-dialog
  title="提示"
  :visible.sync="centerDialogVisible"
  width="30%"
  center>
  <span>需要注意的是内容是默认不居中的</span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="centerDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="centerDialogVisible = false">确 定</el-button>
  </span>
</el-dialog>

<script>
  export default {
    data() {
      return {
        centerDialogVisible: false
      };
    },
    methods: {
    	refreshData() {
    		console.log(1)
    	}
	}		
  }
</script>

猜你喜欢

转载自blog.csdn.net/ka_xingl/article/details/118959559
今日推荐