vuejs copying data object and removing property will remove the property from original object as well

后端 未结 5 588
你的背包
你的背包 2021-02-01 09:27

I have a data object in vue that looks like this

rows[
0 {
  title: \"my title\",
  post: \"my post text\",
  public: false,
  info: \"some info\"
},
1 {
 title:         


        
5条回答
  •  野性不改
    2021-02-01 10:18

    You need to make a copy of your referenced variable.

    // ES6
    let copiedObject = Object.assign({}, originalObject)
    

提交回复
热议问题