Subscribe on changes!

The arrow function is used in vuex, causing computed to fail to get the state in response

avatar
Jan 29th 2024

Vue version

3.3.11

Link to minimal reproduction

https://stackblitz.com/~/github.com/Msg-Lbo/bugDemo

Steps to reproduce

1:点击右侧文件夹按钮选择mp3 2:确认选择

1:Click the folder button on the right to select mp3 2:Confirm selection

What is expected?

播放按钮左侧显示出mp3总时间 The total time of the mp3 is displayed on the left side of the play button

What is actually happening?

在devTools中能够发现musicTime_total发生了变化,但这里使用computed却无法响应式获取 It can be found in devTools that musicTime_total has changed, but it cannot be obtained responsively using computed here.

System Info

No response

Any additional comments?

如果将myAudio.ts中的setMusicTime_total换成普通函数,并按照复现步骤操作,会发现正确的显示了MP3的总时间.我不知道为什么,请告诉我,谢谢 If you replace setMusicTime_total in myAudio.ts with a normal function and follow the steps to reproduce, you will find that the total time of MP3 is correctly displayed.I don't know why, please tell me, thank you