I'm trying to change the value of the data within computed property, but if I use map to change it, the original value in data property changed too.
I read documentation about computed property and it don't change original value.
I read documentation about map and it return a new object with the changes.
new Vue({
el: "#app",
data: {
todos: [
{ text: "Learn JavaScript", done: false },
{ text: "Learn Vue", done: false },
{ text: "Play around in JSFiddle", done: true },
{ text: "Build something awesome", done: true }
]
},
computed: {
todos_computed() {
return this.todos.map((todo) => {
todo.text += ' - Changed'
return todo
})
},
},
})
jsfiddle : https://jsfiddle.net/hkqm6f30/1