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

使用了虚拟列表 virtuaList,为什么元素仍然被渲染 #17209

Open
vizzyo opened this issue Jan 21, 2025 · 1 comment
Open

使用了虚拟列表 virtuaList,为什么元素仍然被渲染 #17209

vizzyo opened this issue Jan 21, 2025 · 1 comment

Comments

@vizzyo
Copy link

vizzyo commented Jan 21, 2025

相关平台

微信小程序

小程序基础库: 3.6.32
使用框架: React

复现步骤

代码如下:

      <VirtualList
        // enhanced
        height={articleList.allHeight}
        width="100%"
        item={ArticleItem}
        itemData={articleList.list}
        itemCount={articleList.list?.length}
        itemSize={(index, itemData) => itemData?.[index || 0]?.itemSize}
      ></VirtualList>

然后查看小程序的DOM元素,发现不可见仍然被渲染了,是正常的表现吗。然后里面的元素也是被渲染了,如video标签,然后video标签里面的资源也在一开始就请求了。

如下图,我一共16个元素,每个元素高度都大概是屏幕高度,每个元素是个图或视频。发现不可见的元素还是会渲染(元素审查可见)
Image

期望结果

不可见的DOM进行元素审查时候,不出现,或是占位dom

实际结果

不可见的DOM仍然完全任然在元素审查时可见

环境信息

Taro v3.6.32


  Taro CLI 3.6.32 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 20.12.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
      npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.32 => 3.6.32 
      @tarojs/components: 3.6.32 => 3.6.32 
      @tarojs/helper: 3.6.32 => 3.6.32
      @tarojs/plugin-framework-react: 3.6.32 => 3.6.32
      @tarojs/plugin-mini-ci: ^3.6.34 => 3.6.35
      @tarojs/plugin-platform-alipay: 3.6.32 => 3.6.32
      @tarojs/plugin-platform-h5: 3.6.32 => 3.6.32
      @tarojs/plugin-platform-jd: 3.6.32 => 3.6.32
      @tarojs/plugin-platform-qq: 3.6.32 => 3.6.32
      @tarojs/plugin-platform-swan: 3.6.32 => 3.6.32
      @tarojs/plugin-platform-tt: 3.6.32 => 3.6.32
      @tarojs/plugin-platform-weapp: 3.6.32 => 3.6.32
      @tarojs/react: 3.6.32 => 3.6.32
      @tarojs/rn-runner: 3.6.32 => 3.6.32
      @tarojs/rn-supporter: 3.6.32 => 3.6.32
      @tarojs/runtime: 3.6.32 => 3.6.32
      @tarojs/runtime-rn: 3.6.32 => 3.6.32
      @tarojs/shared: 3.6.32 => 3.6.32
      @tarojs/taro: 3.6.32 => 3.6.32
      @tarojs/taro-loader: 3.6.32 => 3.6.32
      @tarojs/taro-rn: 3.6.32 => 3.6.32
      @tarojs/webpack5-runner: 3.6.32 => 3.6.32
      babel-preset-taro: 3.6.32 => 3.6.32
      eslint-config-taro: 3.6.32 => 3.6.32
      react: ^18.1.0 => 18.3.1
      react-native: ^0.70.1 => 0.70.15

@wuweikd
Copy link

wuweikd commented Jan 22, 2025

插眼

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

No branches or pull requests

2 participants