When I used LocalePlugin in vux, I ran into a error
- Langage dominant
- Vue
- Étoiles
- 17.5k
- Forks
- 3.6k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
When I used LocalePlugin in vux, I ran into a error as followings :
> vue.esm.js?efeb:591 [Vue warn]: Property or method "$t" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
(found in )
But when I remove statement 1 and statement 2 from my code as followings, everything is OK, and language adaptor works fine. Could you please give me some advice?
```
import store from './store';
import VuexI18n from 'vuex-i18n';
import { LocalePlugin } from 'vux'; // statement 1
Vue.use(VuexI18n.plugin, store);
const vuxLocales = require('json-loader!yaml-loader!../../locales/all.yml');
const componentsLocales = require('json-loader!yaml-loader!../../locales/components.yml');
const finalLocales = {
'en': Object.assign(vuxLocales['en'], componentsLocales['en']),
'zh-CN': Object.assign(vuxLocales['zh-CN'], componentsLocales['zh-CN'])
}
for (let i in finalLocales) {
Vue.i18n.add(i, finalLocales[i])
}
Vue.use(LocalePlugin); // statement 2
Vue.i18n.set('en');
```
The relative package versions are:
"vux-loader": "^1.2.8",
"webpack": "^3.6.0",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-i18n": "^1.10.5",
"vux": "^2.8.1",
And my webpack config is:
```
vuxLoader.merge(devWebpackConfig, {
plugins: [
'vux-ui',
{
name: 'i18n',
vuxStaticReplace: false,
staticReplace: false,
extractToFiles: 'src/locales/components.yml',
localeList: ['en','zh-CN']
}
]
}))
}
}
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.