mounted执行两次
时间: 2023-10-19 21:25:24 浏览: 149
在开发中,如果发现mounted方法执行了两次,可以通过以下方法进行排查。
首先,可以排除是否在mounted方法中使用了this.$store.commit()方法,因为这个方法可能会导致<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [vue mounted 调用两次的完美解决办法](https://download.csdn.net/download/weixin_38606202/13670118)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [vue mounted 调用两次的解决办法](https://blog.csdn.net/weixin_30897233/article/details/98195471)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [vue mounted方法执行多次问题的解决方案](https://blog.csdn.net/Run_youngman/article/details/98098724)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文