I just want to change data in the main app instance
here is data
i have two things in cart contents , data
data: function () {
return {
cart: {contents:[],data:{}},
},
and in the same main instance i added two method to change cart
methods :
addProduct: function (count, price, selected_options, item_data) {
this.cart.contents.push({
count: count, price: price, selected_options: selected_options, item_data: item_data
})
} ,
addCartData: function (dataName, dataValue) {
this.cart.data[dataName]=dataValue
}
when i push element to contents using .push in the first method it is pushed that’s okay
when I push a key with value it to data object in the second method first it pushed
but when I navigate to another route it disappear and give me empty object instead like default