A pinia plugin to help you use vue-router in pinia store
pnpm add pinia-plugin-router -D
or
npm install pinia-plugin-router -D
import PiniaRouter from "pinia-plugin-router"
import {router} from "./router"//your router
const pinia = createPinia()
pinia.use(PiniaRouter(router))
// in your store
const store = defineStore("store",{
actions:{
jump(){
this.$router.push('/demo')
}
}
})
created by template (starter-ts)[https://github.com/OceanPresentChao/starter-ts]