【发布时间】:2019-08-25 22:05:37
【问题描述】:
我正在使用 Nuxt.js,并且安装了两个插件。 我需要从 validate.js 中的 lang.js 访问 VueI18n 实例
有人知道怎么做吗?
lang.js
Vue.use(VueI18n)
export default ({ app }) => {
app.i18n = new VueI18n({
locale: 'en',
messages
})
}
validate.js
Vue.use(VeeValidate, {
i18nRootKey: 'validations',
i18n, // access the VueI18n instance from plugin above
dictionary: {
en: validationMessages
}
})
export default ({ app }) => {
// This way I could get the instance but how to add it to the plugin?
console.log(app.i18n)
}
【问题讨论】:
标签: javascript vue.js nuxt.js