Reputation: 103
I've had a problem
data() {
return {
list: [],
initState: { id: null, data: null }
}
},
computed: {
...mapState({
contacts: (state) => state.ContactBook.Contacts
})
},},
methods: {
setinitState(payload) {
this.initState.data = contacts[this.contactID]
},
How Can I make this.initState static? I need this.initState didnt changes when contacts[this.contactID] changes...
Upvotes: 0
Views: 58
Reputation: 103
state.snapshot = JSON.parse(JSON.stringify(state.Contacts[payload]))
Upvotes: 0
Reputation: 382
You may use the spread operator like this,
this.initState.data = {...contacts[this.contanctID]}
Upvotes: 1