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

https://vtbs.moe/ 网站页面潜在的性能隐患——真实DOM长列表 #248

Open
wdpm opened this issue Dec 14, 2020 · 6 comments
Open
Labels
bug Something isn't working

Comments

@wdpm
Copy link
Member

wdpm commented Dec 14, 2020

问题描述(举例)
Snipaste_2020-12-14_16-17-51

问题代码出处

https://github.com/dd-center/vtbs.moe/blob/master/src/views/Home.vue#L9-L11

      <transition-group name="flip-list">
        <card v-for="vtb in rankLimit" :vtb="vtb" hover :key="vtb.mid" class="card"></card>
      </transition-group>

问题原因:直接使用rankLimit for loop
修复建议:找个成熟的第三方Vue虚拟列表实现,或者自身实现一个简易版虚拟列表,替换原生 for loop
额外补充:其他页面似乎也有真实DOM长列表。🤣

@wdpm wdpm changed the title https://vtbs.moe/ 主页潜在的性能隐患——真实DOM长列表 https://vtbs.moe/ 网站页面潜在的性能隐患——真实DOM长列表 Dec 14, 2020
@simon300000
Copy link
Member

一直想上虚拟列表,也到处做实验,目前太忙没时间ww
也要先把每个元素的高度都定好

@wdpm
Copy link
Member Author

wdpm commented Dec 14, 2020

@simon300000 虚拟列表中的ListItem高度一般是固定的,由你的ListItem元素高度决定,你可以让它高度自扩展,或者直接hardcode一个合适的高度。总之,真的不建议使用真实DOM,scroll时已经明显感到卡卡的。有些聪明的第三方虚拟列表库甚至可以支持动态列表item高度计算。:smile:

@simon300000
Copy link
Member

哈哈,有时间定个高度

@wdpm
Copy link
Member Author

wdpm commented Oct 1, 2021

还没实现虚拟列表的页面

就当给你备忘了。@simon300000

@simon300000
Copy link
Member

2023年年末前一定实现!

@wudifeixue
Copy link
Member

好像还没有解决..

@wudifeixue wudifeixue added the bug Something isn't working label Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants