Vuex uses different variables to store the same arr data, one of which changes, and the other changes accordingly.

problem description

let arr = [
    {
        id: 100112,
        age: 10,
        name: tony
    }, {
        id: 100113,
        age: 12,
        name: Kevin
    }]

    arr commit  statename1, name2)
    name1[0].age
    name2[0].age

the environmental background of the problems and what methods you have tried

arr,commitname1
slice(0), concatarrcommitname2

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

name1 name2
May.22,2021

use JSON to process the original data to be copied

var name1 = JSON.parse(JSON.stringify(arr))
Menu