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

[vue] 使用vue渲染大量数据时应该怎么优化?说下你的思路! #444

Open
haizhilin2013 opened this issue Jun 22, 2019 · 8 comments
Labels
vue vue

Comments

@haizhilin2013
Copy link
Collaborator

[vue] 使用vue渲染大量数据时应该怎么优化?说下你的思路!

@haizhilin2013 haizhilin2013 added the vue vue label Jun 22, 2019
@PanJiaChen
Copy link

Object.freeze

@xixileng
Copy link

xixileng commented Jul 1, 2019

1.如果需要响应式,考虑使用虚表(只渲染要显示的数据);
2.如果不考虑响应式,变量在beforeCreated或created中声明(Object.freeze会导致列表无法增加数据)

@nazhenhuiyi
Copy link

感觉 freeze 是有点多余了,其实本质就是不想要 vue 去观测吧。

@sky124380729
Copy link

Object.freeze

大佬你来啦

@Lizhooh
Copy link

Lizhooh commented Apr 13, 2020

做分页,没有必要渲染这么多数据,一个屏幕都看不完。

@xiao-fe
Copy link

xiao-fe commented May 25, 2020

可以试下可视化渲染

@canvascat
Copy link

虚拟列表:vue-virtual-scroll-listvue-virtual-scroller……
冻结属性,让不必要的属性不响应:Object.freeze, 或者使用 Object.defineProperty 将对象属性的configurable设置为false,源码:vue/src/core/observer/index.js

@hyj443
Copy link

hyj443 commented Oct 27, 2021

如果你有一个巨大的数组或对象,不需要被观测,他的数据是纯展示的,你又需要写在data里,那就用 Object.freeze去冻结他,Vue在内部会跳过对它的观测

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

No branches or pull requests

9 participants