Reputation: 4637
Been playing around with vuejs which is awesome. Wondering if there is any suggestion on how to handle browser refreshes? How do we retain data?
Upvotes: 0
Views: 1796
Reputation: 1482
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.
Upvotes: 1
Reputation: 3863
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"
Upvotes: 5