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]
    },
}

阅读 1k
1 个回答

性能问题一般都是在大量数据上执行时间复杂度高或空间复杂度高的操作,你觉得你这两种写法是数据量大了,还是复杂度高了。还是说两种写法一个页面卡一个页面不卡。需要关注性能的时候你自然会知道性能问题出在哪里

推荐问题