I have a vue.js application and into a componente there's the data method thats returns a nested object like this:
obj: {
color: {
value: '',
},
shape: {
value: '',
},
size: {
value: '',
},
}
Into the template a have inputs with v-models to fill these values:
I can save this values into localStorage with the JSON.stringify method:
methods {
save() {
localStorage.setItem("Itens", JSON.stringify(this.obj))
}
}
and I can get this values from the localStorage with the JSON.parse:
created() {
this.obj = JSON.parse(localStorage.getItem("Itens"))
}
However, when I do this into created the input fields into template aren't filled automatically with the values of obj saved in localStorage, the fields still blank. How can I get these values saved into the localStorage e fill the fields automatically with this storaged values?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)