Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value.

在使用Element弹窗的时候,在关闭弹窗的时候出现了这个问题,代码为

    <el-dialog
    width="30%"
    style="z-index:99999"
    :visible.sync="AreaSamplingVisible"
    @open="open()"
    @closed ="close()"
    append-to-body>
        <ul v-if="isif"  id="administrativeRegion" class="ztree"></ul>
        <span slot="footer" class="dialog-footer">
          <el-button @click="close()">取 消</el-button>
          <el-button type="primary" @click="determine">确 定</el-button>
        </span>
    </el-dialog>

其中AreaSamplingVisible参数是通过父组件传过来的,用来控制弹窗的显示和隐藏,报错为

 

 这是因为AreaSamplingVisible参数是父组件传过来的,不能在子组件中直接对AreaSamplingVisible进行修改,一切的操作都得通过子组件传递给父组件,在父组件中进行AreaSamplingVisible的修改。

posted @ 2021-07-15 17:04  奔跑的哈密瓜  阅读(161)  评论(0编辑  收藏  举报