Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第65题:子组件为何不可以修改父组件传递的 Prop? #65

Open
noxussj opened this issue Jun 18, 2020 · 0 comments
Open
Labels

Comments

@noxussj
Copy link
Owner

noxussj commented Jun 18, 2020

单向数据流,易于监测数据的流动,出现了错误可以更加迅速的定位到错误发生的位置

处理方法

  1. 如果想要改变prop的值,可以在子组件编写一个computed属性
  2. 在子组件利用$emit传递事件给父组件,父组件监听该事件改变prop值
@noxussj noxussj added the Vue label Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant