简体   繁体   English

在 VueJs 中处理大数据

[英]Handling large data in VueJs

I currently have large list which holds around 1k+ records and these records are bind to table.我目前有一个很大的列表,其中包含大约 1k+ 条记录,并且这些记录绑定到表中。 The table also consists of input elements like textbox, dropdown which are used to update the list data.该表还包含用于更新列表数据的输入元素,如文本框、下拉列表。 The problem now is obviously regarding performance when the list is bind to DOM and it's also sluggish during scrolling.现在的问题显然与列表绑定到 DOM 时的性能有关,并且在滚动过程中也很缓慢。 Is there anything that can be improved?, I don't want to use pagination and also can't use virtual-scroll as i have input elements as they would trigger update event.有什么可以改进的吗?我不想使用分页,也不能使用虚拟滚动,因为我有输入元素,因为它们会触发更新事件。 Here's just an example:这只是一个例子:

 new Vue({ el: '#app', data: { bigData: new Array(100000) } })
 <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.5/vue.js"></script> <div id="app"> <table> <thead> <tr> <td>Id</td> <td>Random Text</td> </tr> </thead> <tbody> <tr v-for="(item, index) in bigData"> <td>{{ index }}</td> <td><input type="text" v-model="index"><td> </tr> </tbody> </table> </div>

I had a similar problem, after lots of testing, I came to the conclusion its the best to use pages in combination with filters.我有一个类似的问题,经过大量测试,我得出的结论是最好将页面与过滤器结合使用。 (I had 5*100 inputs.) (我有 5*100 个输入。)

The problem is that your browser start lagging because the JS and HTMl to parse just gets much.问题是您的浏览器开始滞后,因为要解析的 JS 和 HTMl 得到了太多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM