Access router in Pinia store defined using composition API (Setup store) #15468
-
From the doc, Router can be accessed in Option API store such as:
How can I achieve the same using Composition API store ?
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 20 replies
-
Beta Was this translation helpful? Give feedback.
-
With Pinia setup stores you should be able to use |
Beta Was this translation helpful? Give feedback.
-
because of Quasar wrappers you need to do so, please look at the function notations of router variable, this is function exactly
than you will get what you want in every pinia store, that's it |
Beta Was this translation helpful? Give feedback.
-
none of the above suggestions works for me. why is this so complicated? e.g. Isn'there an easier option to add router to a composition api pinia store in quasar? |
Beta Was this translation helpful? Give feedback.
With Pinia setup stores you should be able to use
useRouter
fromvue-router
directly.