英文:
VueJS and Axios causing 'error during execution of scheduler flush' and Uncaught (in promise) TypeError
问题
所以我已经检查了我的代码一段时间,发现这个错误是由这行代码引起的:
treeNodes.value = documentStore.convertToTree((await axios.get('/File')).data);
首先,我收到了以下警告:
Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core
然后,我收到了这个错误:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')
尝试阅读了一些旧帖子,但没有找到有用的信息。
有什么想法吗?谢谢。
英文:
So i have been poking my code for a while and found out that this error is caused specifically by this line of code:
treeNodes.value = documentStore.convertToTree((await axios.get('/File')).data);
First i get warning saying:
Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core
and then i get this error:
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')
Tried read some older threads but found nothing helpful.
Any ideas?
thanks
答案1
得分: 0
所以我弄清楚了。
问题是我试图在组件挂载之前初始化 treeNodes。
所以我只是在 onMounted 中初始化它,它正常工作。
英文:
So i figured it out.
The problem was that i tried to initialize treeNodes before component was mounted.
So i just init it in onMounted and it works fine.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论