Skip to content

How to get Pinia store inside the plugin function? #9275

Discussion options

You must be logged in to vote
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 ''
           ......
        }
    }
}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@camohub
Comment options

@douglasg14b
Comment options

Answer selected by camohub
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