fixed not support Nuxt.js

This commit is contained in:
梁灏 2017-11-16 11:02:01 +08:00
parent 1cbdb617bf
commit 54f510c528
2 changed files with 17 additions and 4 deletions

View file

@ -22,6 +22,14 @@ module.exports = {
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': {

View file

@ -1,11 +1,16 @@
// using with vue-i18n in CDN
/*eslint-disable */
import Vue from 'vue';
const isServer = Vue.prototype.$isServer;
export default function (lang) {
if (typeof window.iview !== 'undefined') {
if (!('langs' in iview)) {
iview.langs = {};
if (!isServer) {
if (typeof window.iview !== 'undefined') {
if (!('langs' in iview)) {
iview.langs = {};
}
iview.langs[lang.i.locale] = lang;
}
iview.langs[lang.i.locale] = lang;
}
};
/*eslint-enable */