vue.runtime.esm.js:619 [Vue warn]: Avoid mutating a prop directly since the value will be overwritte
最编程
2024-07-28 07:34:40
...
<template>
<el-dialog
title="XXXX"
:visible.sync="IsShowPage"
/>
</template>
<script>
export default {
name: 'NoteBookLimitFlow',
props: {
isVisible: {
type: Boolean,
default() {
return false
}
}
},
data() {
return {
// 定义一个IsShowPage来接收传递过来的值
IsShowPage: this.isVisible
}
},
watch: {
isVisible(val) {
this.IsShowPage = val// 新增isVisible的watch,监听变更并同步到IsShowPage上
}
}
}
</script>
上一篇: HTML里的相对定位与绝对定位:一探究竟