vue3的setup语法糖中,父组件传给子组件一个引用类型的props,子组件中需要修改这个props,但是又不能引起父组件中这个数据的变化,如何实现? #9631
Unanswered
StrongerLph
asked this question in
Help/Questions
Replies: 1 comment 6 replies
-
The subcomponent is modified after deepClone const clone = ref(JSON.parse(JSON.stringify(data))) |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
vue3的setup语法糖中,父组件传给子组件一个引用类型的props(props里的数据是从接口异步获取的),子组件中需要修改这个props,但是又不能引起父组件中这个数据的变化,如何实现?尝试了cloneDeep、computed等都没有效果。

Beta Was this translation helpful? Give feedback.
All reactions