[Vuejs]-How to handle browser refresh in vuejs applications

5👍

Your question i guess is:”how to get data when browser have been refreshed?”,maybe you can try these method:

for example,use localstorage to put and get data:

//before refresh,set data to LocalStorage
localStorage.setItem("foo","i am foo")

//when browser refreshed,get data back
localStorage.getItem("foo") // get:"i am foo"
👤Kaicui

1👍

Like Kaicui said. Question is more about persisting data in vuejs app.
Maybe you can try vue-session


this.$session.start()
this.$session.set('token', 0000)
this.$session.get('token')

it is really easy to use.

👤tim

Leave a comment