Skip to content

[Vue warn]: Property "$pinia" was accessed during render but is not defined on instance #2331

Closed Answered by jumpapex
jumpapex asked this question in Help and Questions
Discussion options

You must be logged in to vote

finally, I got it resolved(but not know the reason :) ).

for quasar, it need a file src/stores/index.js to do pinia initialization

import { store } from 'quasar/wrappers'
import { createPinia } from 'pinia'

/*
 * If not building with SSR mode, you can
 * directly export the Store instantiation;
 *
 * The function below can be async too; either use
 * async/await or return a Promise which resolves
 * with the Store instance.
 */

export default store((/* { ssrContext } */) => {
  const pinia = createPinia()

  // You can add Pinia plugins here
  // pinia.use(SomePiniaPlugin)

  return pinia
})

(https://quasar.dev/quasar-cli-vite/state-management-with-pinia/)

But it is still puzzled that …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@posva
Comment options

Answer selected by posva
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2330 on July 30, 2023 06:17.