objective-c - Use axios to modify data through vuex mutation getter failed for the first time and succeeded for the second time
伊谢尔伦2017-06-28 09:27:29
0
2
1133
The first getter is undefined But after the data is changed, the getter data becomes available Shouldn’t the getter data be changed accordingly What is the reason for this
The first time getSongList in your state is {}, so when you print it, it must be {__ob__:Observer}, because computed is related to dependencies. If dependencies change, the data in computed will change, so you will mutate later The data is requested and getSongList has a value, so the printing is different. You can try changing getSongList to null and you will know
@tony_gong
![](http://img.php.cn/upload/image/000/000/000/0a5552c0b86f68a86a2c7e52dae2c83b-0.png)
The data also exists here
![](http://img.php.cn/upload/image/000/000/000/3df97bc9ba474c7af3e40e1b57702050-1.png)
The first time getSongList in your state is {}, so when you print it, it must be {__ob__:Observer}, because computed is related to dependencies. If dependencies change, the data in computed will change, so you will mutate later The data is requested and getSongList has a value, so the printing is different. You can try changing getSongList to null and you will know