You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on vue3 with composition Api and Vite (cf vitesse https://github.com/antfu/vitesse/tree/main), and its working well for me.
Here's my implementation:
src/main.ts:
import{ViteSSG}from'vite-ssg'import{setupLayouts}from'virtual:generated-layouts'import*ascookiesfrom'vue-cookies'// import Previewer from 'virtual:vue-component-preview'importAppfrom'./App.vue'importgeneratedRoutesfrom'~pages'import'./styles/main.scss'constroutes=setupLayouts(generatedRoutes)// https://github.com/antfu/vite-ssgexportconstcreateApp=ViteSSG(App,{ routes,base: import.meta.env.BASE_URL},(ctx)=>{ctx.app.use(cookies)},)
src/composables/cookies.ts:
import{inject}from'vue'importtype{VueCookies}from'vue-cookies'exportfunctionuseCookies(): VueCookies{const$cookies=inject<VueCookies>('$cookies')// For js, use const $cookies = inject('$cookies')return$cookiesasVueCookies}
I've read how to use
vue-cookies
in composition api. int that place:Then i use inject for using $cookie in composition api, but i received this bug:
What should i do ? How i can fix that ?
The text was updated successfully, but these errors were encountered: