为什么在promise或则callback里通过setdata无法刷新swiper-item的内容?

微信问答 文章 2021-12-03 10:20 312 0 全屏看文

AI助手支持GPT4.0

为什么在promise或则callback里通过setdata无法刷新swiper-item的内容?Why can't I refresh the content of swiper-item through setdata in promise or callback?

为什么在promise或则callback里通过setdata无法刷新swiper-item的内容?

最近遇到很奇怪的一个现象,在promise或callback里是无法通过setdata有效刷新swiper-item 的显示内容的。比如我需要在服务器通过异步获取一些url,然后通过setdata更新到与swiper-item相关的array中,然后你会发现,在promis或callback里无论通过怎样形式的setdata都是没效果的,在此外却可以正常刷新,请问这是问什么?是异步闭包的问题?不应该啊~其他组件的更新都一切正常,唯独swiper-item不行!谁能教教我?急急急急急急!!!感谢!

Recently, I encountered a strange phenomenon. In promise or callback, it is impossible to effectively refresh the display content of swiper item through SetData. For example, I need to get some URLs asynchronously on the server, and then update them to the array related to swiper item through SetData. Then you will find that no matter what form of SetData is used in promise or callback, it can be refreshed normally. What is this? Is it an asynchronous closure problem? No, the updates of other components are normal, except for the wiper item! Who can teach me? Urgent, urgent, urgent!!! thank!

鍥炵瓟锛�

八九:

排查下作用域

任性༄:

this的作用域问题?

武曲心:

没遇到过这问题,贴出你的代码和数据结构看看

-EOF-

AI助手支持GPT4.0