0👍
✅
If you don’t want to introduce an event bus, or something like vuex
, just write it to the sessionStorage:
window.sessionStorage.setItem('localUser', JSON.stringify(this.localUser))
then in Home
:
computed: {
localUser: {
get: function() {
return JSON.parse(window.sessionStorage.getItem('localUser'))
}
}
}
and now Home
can use this.localUser
in the script and localUser
in the SFC template.
Source:stackexchange.com