常識
1.computed計算屬性,使用的屬性必需在data里面聲明。
computed: { canLogin: function(){ //注意這里的依賴的屬性必需在data里面聲明 return this.name && this.password; } }
Webpack問題
1.模塊里面使用JSON.stringify和 typeof,報:Uncaught TypeError: Cannot assign to read only property 'exports' of #<Object>
解決方法:把.babelrc里的plugin "transform-runtime" 刪掉, 重啟運行
Vue控件問題
1.VueI18n的messages設置無效問題
//messages得單獨寫出來,不然會報[vue-i18n] Cannot translate the value of keypath “”. Use the value of keypath as default. const messages = { 'lang': path.i18n } const i18n = new VueI18n({ locale: 'lang', messages }) new Vue({ ..... i18n })