Answer the question
In order to leave comments, you need to log in
Why is data being erased from localStorage?
Hello, I ran into such a problem, I have a shopping cart on Vue.js without Node, just like a library, the fact is that I store product data in localStorage:
[
{id: "16", title: "Arcturus", url: "arcturus",…},
{id: "63", title: "Alamo Frills", url: "alamo-frills",…},
{id: "88", title: "Dolores' Raspberry Sundae", url: "dolores-raspberry-sundae",…},
{id: "34", title: "Kei-Yoki", url: "kei-yoki",…}
]
let app = new Vue({
el: '#app',
data: {
// если нет cart в localStorage, то будет пустой массив
cart: !store.has('cart') ? [] : store.get('cart'),
qty: 1
},
...
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question