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?
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"
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.