暂时 把遇到的问题 先列一下 回来总结
1. 引入 vux
vux2 必须配合 vux-loader 使用, 请在 build/webpack.base.conf.js 里参照如下代码进行配置:
- const vuxLoader = require('vux-loader')
- const webpackConfig = originalConfig // 原来的 module.exports 代码赋值给变量 webpackConfig
- module.exports = vuxLoader.merge(webpackConfig, {
- plugins: ['vux-ui']
- })
2. 引入 以后报错 $t()not function
html 代码
- import vuex from 'vuex';
- import vuexI18n from 'vuex-i18n';
- Vue.use(VueResource);
- Vue.use(Vuex);
- const store = new Vuex.Store({
- modules: {
- i18n: vuexI18n.store
- }
- });
- Vue.use(vuexI18n.plugin, store);
- const translationsEn = {
- "content": "This is some {type} content"
- };
- // translations can be kept in separate files for each language
- // i.e. resources/i18n/de.json.
- // add translations directly to the application
- Vue.i18n.add('en', translationsEn);
- // set the start locale to use
- Vue.i18n.set('en');
来源: http://www.qdfuns.com/article/38681/3bd62d0c634872632c621f826fe26922.html