import Vue from 'vue' import store from './store' const plugin = { install(Vue, options) { Vue.prototype.$dict = (type) => { return { async ready() { await store.dispatch('dict/fetch') }, get(key) { return store.getters.dict?.[type]?.[key] ?? key ?? '--' }, all() { return store.getters.dict?.[type] ?? [] } } } } } Vue.use(plugin)