Open MarceloLuis1997 opened 3 years ago
Since I also hit this roadblock when migrating a Vue 2 application to Vue 3, I replaced vue-session
with Pinia and pinia-plugin-persistedstate to store my session data and I just works great!
There are essentially no reason that this nice utility should be in a vue plugin as it is only a wrapper for localStorage/sessionStorage.
I have created a CustomVueSession like this to continue support for this.$session.get
but still enable me to call import { getSession } from "./CustomVueSession.js"
and then use getSession()
inside my composition api style code:
import VueSession from "vue-session"
in main.js to import VueSession from "./CustomVueSession.js"
Are this plugin going go work with Vue3? I am migrating my Vue2 App to use
@vue/composition-api
and I would like to know if there is any way to use it insidesetup()
.It still working because
context.root.$session
works in Vue2, howevercontext.root
will no longer be available in Vue3.