您的当前位置:首页>全部文章>文章详情

vuex中的数据为对象数组,更改数据失败

发表于:2023-09-09 08:27:46浏览:81次TAG: #Vue

解决方案:
需要用到对象的深拷贝

computed:{
    ...mapState({
        siderightItems:state => state.sideright.siderightItems ,
    })
}
itemClick:function(index){
    let list = [] ;
    for(let item of this.siderightItems){
        let a = Object.assign({},item) ;
        list.push(a) ;
    }
}