The question about props

A dialog box is made with element. The visible.sync property value that pops up in the dialog box is controlled by props to receive the value from the parent component. It functions normally at first, but it will give a warning when you click to close the dialog box. The reason is that the close button that comes with elemen changes the method of using variable to replace props, but finds that it cannot be switched normally.

<template>
  <el-dialog title="" :visible.sync="visible">
  <el-table :data="gridData">
    <el-table-column property="date" label=""></el-table-column>
    <el-table-column property="name" label=""></el-table-column>
    <el-table-column property="detail" label=""></el-table-column>  
  </el-table>
</el-dialog>
</template>

<script>
  export default{
    props:["dialogTableVisible","gridData"],
    data(){
      return {
        visible:this.dialogTableVisible
      }
    }
  }
</script>
Feb.24,2022

the control component displays the parameters passed in the parent component

<el-dialog title="" :visible.sync="dialogTableVisible">

listen for one of its shutdown events

<el-dialog title="" :visible.sync="dialogTableVisible" @close="handleClose">
methods: {
    handleClose(value){
        this.$emit('close', value);
    }
}

listen for close events from child components emit in the parent component

<child @close="handleClose" :dialogTableVisible="dialogTableVisible" />
methods: {
    handleClose(value){
        console.log(value);
       //  dialogTableVisible 
       this.dialogTableVisible = value;
    }
}

you only give an initial value to visible . When the parent component changes the value of dialogTableVisible later, the child component will not be updated.

data(){
  return {
    visible:this.dialogTableVisible
  }
}
Menu