vue中子组件修改props
父组件用sync修饰,子组件在 computed 的 set 中通过$emit('update:参数',值)
函数去修改。
<!-- 父组件 --> <customComponent :isShow.sync="isShow"></customComponent> <!-- 子组件 --> computed() { show: { get() { return this.isShow; }, set(v) { this.$emit('update:show', v); } } }