Files
vxe-table/examples/views/table/optimize/Edit.vue
xuliangzhan 01d26a6a32 update
2019-08-09 23:44:29 +08:00

16 lines
1.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<p class="red">问题现象当表格数据量较大时单元格输入卡顿输入框比较严重输入后明显感觉会卡顿一会</p>
<p>Vue 响应机制双向绑定对于非数组类型的数据是非常友好的但对于数组就没那么友好了特别是数据量大的数组只要列表中有 input 去修改某个值就会重新执行 render 函数这时运算量取决于数据的大小数组越大执行越久卡顿时间也就越久</p>
<p class="red">问题所在 input 输入改变数组中的值导致 Vue render 频繁执行产生短暂卡顿</p>
<p>优化方案1如果数据量超大 200+ 通过<router-link class="link" :to="{name: 'TableScroll'}">虚拟滚动方式</router-link>按需加载比如将数组拆分成可视区 100 由于数量的减少所以即使 render 函数执行得再频繁也是很快的</p>
<p>优化方案2如果数据量 200 条以下单元格输入框不要使用任何组件特别是 v-model 应该使用原生的输入框配合<router-link class="link" :to="{name: 'RendererAPI'}">渲染器</router-link>实现 input 事件改成 change 事件避免 render 函数频繁执行这样就可以使输入框很流畅了</p>
</div>
</template>
<style lang="scss" scoped>
p {
font-size: 16px;
}
</style>