How to get Pinia store inside the plugin function? #9275
Answered
by
Alfred-Skyblue
camohub
asked this question in
Help/Questions
Replies: 2 comments 2 replies
-
import { useAppStore } from '@/store/app'
export default {
install: (app) => {
console.log(app)
const appStore = useAppStore()
console.log(appStore)
app.config.globalProperties.$translate = (translations, key) => {
let result = translations[key] ? translations[key][0] : '' // First item as default value or ''
......
}
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
camohub
-
Can you tell me how to get this helpers.translate() function insde composition api code? I made this inside view file
So helpers object is there but I can not use translate object. Nor the helpres.translate nor translate is available. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a helpers plugin which need to access Pinia store. The plugin have access to app object as all Vue plugins. I there a way to get Pinia store object from app instance inside the plugin? The plugin looks like
Beta Was this translation helpful? Give feedback.
All reactions