Skip to content

use router in pinia #1092

Closed Answered by janjas92
arduinoes asked this question in Help and Questions
Feb 23, 2022 · 2 comments · 13 replies
Discussion options

You must be logged in to vote

Hi,
add router to pinia like that:
const pinia = createPinia() pinia.use(({ store }) => { store.router = markRaw(router) }); app.use(pinia)
then you have access to router in pinia store by the this. I don't now why in my case (i use typescript) webstorm don't see this.router but he is there ;) I add @ts-ignore to let phpstorm not complain for now

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
6 replies
@janjas92
Comment options

@rashidpathiyil
Comment options

@janjas92
Comment options

@webdev-laszlo
Comment options

@davidrunger
Comment options

Answer selected by posva
Comment options

You must be logged in to vote
7 replies
@josh2112
Comment options

@dsubo
Comment options

@ga676005
Comment options

@juan-carvajal
Comment options

@artush-alexanyan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet