vue 封装弹窗组件注意

2022-05-05 16:59:56 浏览数 (2)

父组件

代码语言:javascript复制
<template>
    <div>
    <p  @click="onDelete">
       打开
     </p>
    <!-- 弹框 -->
    <code-dialog
      :status.sync="deleteDialogStatus"
    />
  </div>
</template>
<script>
import codeDialog from "./code";
export default {
components: {
    codeDialog
  },
  name: "detailsDialog",
  data() {
    return {
      deleteDialogStatus: false
    };
  },
  methods: {
    onDelete() {
      this.deleteDialogStatus = true;
    }
};
</script>

子组件

代码语言:javascript复制
<template>
  <div>
    <el-dialog
      title=""
      :visible.sync="show"
      :center="true"
      :show-close="false"
      :close-on-click-modal="true"
      class="deletes"
    >
    
    </el-dialog>
  </div>
</template>

更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/118721031

0 人点赞