November 2017
Beginner to intermediate
398 pages
8h 42m
English
Now, we would like to save and restore the notes between sessions, just like we did for the note content:
methods: {
...
saveNotes () {
// Don't forget to stringify to JSON before storing
localStorage.setItem('notes', JSON.stringify(this.notes))
console.log('Notes saved!', new Date())
},
},
Like we did for the previous content property, we will watch the notes data property for changes to trigger the saveNotes method.
watch: {
notes: 'saveNotes',
}
Now, if you try to ...
Read now
Unlock full access