vueprops无法修改
时间: 2023-08-26 11:13:14 浏览: 159
在Vue中,props是单向的,意味着父组件可以向子组件传递数据,但子组件不能直接修改props的值。这是为了防止子组件无意中修改了父组件的状态。所以当你尝试直接修改props的值时,Vue会发出警告。在这种情况下,你需要确保传递给props的值的类型与组件定义的props的类型一致。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [Vue props用法详解](https://blog.csdn.net/Rainbow1995/article/details/103122692)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *2* [vue props 传值](https://blog.csdn.net/gansilian/article/details/106187078)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *3* [vue props使用typescript自定义类型](https://blog.csdn.net/w55100/article/details/124624300)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文