Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] van-list 组件 load未执行 #10727

Closed
babalrlr opened this issue Jun 19, 2022 · 5 comments
Closed

[Bug Report] van-list 组件 load未执行 #10727

babalrlr opened this issue Jun 19, 2022 · 5 comments

Comments

@babalrlr
Copy link

重现链接

https://stackblitz.com/edit/nuxt-starter-4ykunz

Vant 版本

3.5.1

描述一下你遇到的问题。

van-list 组件 load未执行

重现步骤

进入首页后,然后点击【go b.vue】,load未执行

设备/浏览器

No response

@babalrlr babalrlr changed the title van-list 组件 load未执行 [Bug Report] van-list 组件 load未执行 Jun 19, 2022
@chenjiahan
Copy link
Member

可以手动调用一下 List 组件的 check 方法来进行滚动状态检测

@babalrlr
Copy link
Author

onMounted(() => { setTimeout(() => { refVanList.value.check(); },100); });

业务代码里,必须要加上 setTimeout才行。

跟踪组件代码后,发现组件内,onMounted时会执行check方法,isHidden(root) 的结果是true。

组件不是已经挂载了吗,为什么 el.offsetParent === null 的结果是true。

@chenjiahan 老板方便解答一下吗

@chenjiahan
Copy link
Member

估计和 Nuxt 切换 route 的实现有关,可以把 setTimeout 改成 nextTick 或 requestAnimationFrame 试试

@babalrlr
Copy link
Author

好的吧。
@chenjiahan 感谢感谢😁

@babalrlr
Copy link
Author

根据大佬的指点,在nuxt中有找到这个问题,相关链接

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants