使用vue2.0的v-for渲染一个div,v-for数组变化时,重绘性能很低,页面很卡

我使用v-for渲染一个div,然后改变渲染的数组,那么div的内容会重绘,但是页面很卡

//content是组件数组,用作v-forthis.content = ['com1','com2','com3','com4']

<div id="test">
    <div :is="item" v-for="(item,index) in content"></div>
</div>

如果我改变content数组的内容,比如改成:

this.content = ['new1','new2','new3','new4','new5','new6','new7']

那么这时候id为test的div里面的内容会重绘,由于我的组件内容很多,重绘的时候,页面会卡顿,请问有什么好的解决方案吗?


侃侃尔雅
浏览 3301回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript