首页 > 其他 > 详细

14 el-dialog 基本结构

时间:2020-06-15 12:37:32      阅读:44      评论:0      收藏:0      [点我收藏+]

1 dialogVisible父组件提供,:visible.sync直接修改父组件的dialogVisible,会报错,需要加上before-close属性 

<template>

  <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
    <span>这是一段信息</span>
    <span slot="footer" class="dialog-footer">
      <el-button @click="handleCancel">取 消</el-button>
      <el-button type="primary" @click="handle">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export default {
  name: "InfoIndexDialog",
  props: {
    dialogVisible: {
      type: Boolean,
      required: true
    }
  },
  data() {
    return {};
  },
  methods: {
    changePropsDialogVisible() {
      this.$emit("update:dialogVisible", false);
    },
    handleClose() {
      this.changePropsDialogVisible();
    },
    handleCancel() {
      this.changePropsDialogVisible();
    },
    handle() {
      this.changePropsDialogVisible();
    }
  }
};
</script>
<style lang="scss" scoped>
</style>

 2.重置表单

this.$refs[‘formname‘].resetFields();生效方法前提是必须给每个form-item加上prop

14 el-dialog 基本结构

原文:https://www.cnblogs.com/xiaoliziaaa/p/13129668.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!