Vue 性能小问题
下面A&B两种方式,性能会更高?
A:computed: {
...mapState('xxx', {
item(state) {
return state.itemlist[this.id]
}
})
}
B:
computed: {
...mapState('xxx', [
'itemlist'
]),
item() {
return this.itemlist[this.id]
},
}
回答:
性能问题一般都是在大量数据上执行时间复杂度高或空间复杂度高的操作,你觉得你这两种写法是数据量大了,还是复杂度高了。还是说两种写法一个页面卡一个页面不卡。需要关注性能的时候你自然会知道性能问题出在哪里
以上是 Vue 性能小问题 的全部内容, 来源链接: utcz.com/p/935834.html