一、
TypeError:_self。$ scopedSlots.default不是renderCell的函數(shù)
(eval at(app.js:1425),:10386:45)
- 解決辦法:
使用v-show代替v-if
https://blog.csdn.net/Zxiuping/article/details/84099969
二、
Cannot read property xxx of undefined (
Cannot read property 'xxx' of null
Cannot read property 'focus' of undefined
- 解釋:
使用.xxx的那個對象為undefined
三、
解決 vue.js在火狐瀏覽器報錯 "event is not defined" 的問題
https://blog.csdn.net/u012317188/article/details/79031327
四、
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
https://www.cnblogs.com/zhn0823/p/6820605.html?utm_source=itdadao&utm_medium=referral
五、
Invalid default value for prop "value": Props with type Object/Array must use a factory function to return the default value
- 解釋:
props default 數(shù)組/對象的默認值應(yīng)當由一個工廠函數(shù)返回
https://segmentfault.com/q/1010000009467326
六、
vue項目報錯如下:(Emitted value instead of an instance of Error)
- 解決辦法:
檢查下你的列表組件里,slot 里的 <template> 上面有個 scope 屬性,你改成 slot-scope
https://blog.csdn.net/moxiaoya1314/article/details/78378194
七、
Invalid prop: type check failed for prop "value". Expected String, Number, got Undefined.
- 解釋:
prop期待傳入數(shù)組,傳入的卻是字符串。類型錯誤
https://www.iphpt.com/detail/98/
八、
Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
- 解決方法:
把import修改為require
https://blog.csdn.net/liangklfang/article/details/53694994
九、
npm install 報node-sass錯誤
- 解決辦法呢 npm i node-sass 重新下載一遍,再執(zhí)行 npm install
https://www.cnblogs.com/drizzle-wen/p/8117607.html
十、
vue組件中 style報錯 Newline required at end of file but not found
- 原因:項目中使用了eslint,且定義了文件規(guī)范,最后一行需要空行
解決辦法:style后面回車 多空出一行
https://blog.csdn.net/genziisme/article/details/71403135
十一、
vue使用jquery,警告 '$' is not defined
- 解決辦法:修改根目錄下.eslintrc.js文件,在module.exports中,為env添加一個鍵值對 jquery: true
env: {
browser: true,
jquery: true // 添加
}
https://blog.csdn.net/qq_35430000/article/details/80960423
十二
vue中引入并且使用jquery,修復使用eslint時報 $、 jquery找不到的錯誤
https://blog.csdn.net/qq_35430000/article/details/80960423
十三、
移動vue項目,啟動錯誤:Module build failed: Error: No PostCSS Config found in:
https://blog.csdn.net/qq_26744901/article/details/80434684
十四、
You may use special comments to disable some warnings. Use // eslint-disable-next-line to ignore the next line. Use /* eslint-disable */ to ignore all warnings in a file.
- 解釋:你可以使用特殊注釋禁用某些警告。使用//eslint disable next line忽略下一行。使用/eslint disable/忽略文件中的所有警告?!?/li>
- 解決辦法:
module: {
rules: [
//...(config.dev.useEslint ? [createLintingRule()] : []), // 注釋或者刪除
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
...
}
]
}
https://www.cnblogs.com/gaoquanquan/p/9550169.html
十五、
Vue.js報錯"TypeError: Cannot read property 'name' of undefined"
https://blog.csdn.net/qq_41999617/article/details/86473650
十六、
Error in render: "TypeError: Cannot read property 'XXXXX' of undefined"
- 解決方法:a.b.c層數(shù)太多了,改一下,改為一層,改為a.b
https://blog.csdn.net/l_z_w99/article/details/82665946
十七、
[Vue warn]: Error in event handler for "click": "TypeError: Cannot read property 'validate' of undefined"
- 解決方法: this.$refs.form.validate()中的與ref="form"名字叫的不一致,或者沒有定義ref。
https://blog.csdn.net/qq_37495786/article/details/83692544
十八、
vue開發(fā)中v-for在Eslint的規(guī)則檢查下出現(xiàn):Elements in iteration expect to have 'v-bind:key' directives
- 原因: VScode編輯器vue開發(fā)過程中,因為安裝了ESLint插件,對vue進行了eslint檢查,只需將這個規(guī)則檢查屏蔽掉即可
https://blog.csdn.net/jagger_guo/article/details/78942692
十九、
vue報錯Cannot read property 'addEventListener' of null"
- 原因:獲取id元素的時候沒有獲取到,頁面中的這個id元素不是在dom加載完成之后動態(tài)添加上去的。
https://ask.csdn.net/questions/717925
二十、
element-ui 會報錯:Error: No PostCSS Config found in element-ui/lib/theme-chalk(多個項目復用node_modules,npm install 時報錯)
- 解決辦法:(npm install 不會產(chǎn)生該文件,仍可能會發(fā)生報錯)
element-ui/lib/theme-chalk里面創(chuàng)建了postcss.config.js文件,內(nèi)容為:
module.exports = {}
https://blog.csdn.net/weixin_43249693/article/details/84766441
- 解決辦法(永久有效):
根目錄下創(chuàng)建postcss.config.js文件,內(nèi)容為:
module.exports = {
plugins: {
'autoprefixer': {browsers: 'last 5 version'}
}
}
https://blog.csdn.net/jokren/article/details/86065217
二十一、
在圖片地址src不變的情況下,瀏覽器重新加載圖片失敗,圖片未刷新
- 原因:在src不變時,瀏覽器直接就去讀取緩存
- 解決辦法:在圖片路徑上拼接一個隨機數(shù),可以讀取到圖片路徑的變化,重新加載圖片
var img_src ='http://www.ilsea.net/images/seagull.jpg?t='+Math.random();
https://blog.csdn.net/maoxunxing/article/details/40618617
二十二、
setInterval只執(zhí)行一次
- 解決辦法:
setInterval(direct, 1000);//去掉括號就好
https://bbs.csdn.net/topics/392057623?page=1
二十三、
Vue.js報錯"TypeError: Cannot read property 'name' of undefined"
{{info.supports}}是不會報錯的,{{info.supports.name}}報錯
- 原因:info.supports是undefined,undefined.name就報錯了
- 解決辦法:v-if
<span v-if="info.support">{{info.supports.name}}</span>
https://blog.csdn.net/qq_36742720/article/details/83627213
二十四、
Connection refused [tcp://127.0.0.1:6379]
- 原因:6379默認是redis的端口,redis服務(wù)未啟動
https://blog.csdn.net/abcde158308/article/details/54380435?utm_source=blogxgwz3
二十五、
圖片未加載完成,圖片不顯示(本地的圖片)
- 解決辦法:將圖片路徑定義為變量
<img :src="imgUrl">
data(){
return {
imgUrl: require("@/assets/images/fk.jpg"); // 圖片路徑用 @
}
}
https://blog.csdn.net/qq_41387882/article/details/82690337?utm_source=blogxgwz3
二十六、20200727 新增
-
解決1:
[vue-router] Duplicate named routes definition: { name: "home", path: "/home" }
- 原因:vue 項目,路由為 / ,和 /home ,掛載的組件都是同一個,就會在控制臺報警告
{
path: '/',
redirect: {
name: 'home'
}
},
{
path: '/home',
name: 'home',
component: home
},
https://blog.csdn.net/weixin_34106122/article/details/88204390
-
解決2:
[vue-router] Duplicate named routes definition: { name: "模板", path: "/exam/" }
- 重復命名路由,在路由配置文件中,找到對應(yīng)name,會發(fā)現(xiàn)有兩處或者兩處以上都使用了“模板”這個name;
- 解決辦法:
直接刪除獲取修改name使其具有唯一性即可。
https://blog.csdn.net/weixin_42941619/article/details/88782765
https://www.cnblogs.com/sweet-ice/p/10606598.html
二十七、
[Vue warn]: The data property "record" is already declared as a prop. Use prop default value instead.
- 翻譯:數(shù)據(jù)屬性“record”已聲明為prop。 請改用prop默認值。即,子組件接收父組件值得時候已經(jīng)用了record這個key,但是在子組件的data里又定義了record,所以報錯
- 解決:把 data 或 prop 中的record 換一個名字
https://www.cnblogs.com/bobo1/p/11340710.html
二十八、
Navigating to current location (XXX) is not allowed
- 原因:在路由中添加了相同的路由。
- 解決:
重寫路由的push方法
在src/router/index.js 里面import Router from 'vue-router'下面寫入下面方法即可
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error)
}
https://www.cnblogs.com/lxk0301/p/11671256.html
二十九、
Error in v-on handler: "TypeError: _vm.shortDomain is not a function"
- 解決辦法:data里的屬性和方法名重名了,重新改個方法名就可以了
https://blog.csdn.net/TanMengyi/article/details/94405528
三十、
Duplicate keys detected: '0'. This may cause an update error.
- 解決辦法:一個template中有兩個一樣的v-for,將其中的一個key改一下
https://www.cnblogs.com/home-/p/11693836.html
三十一、js賦值后,改變現(xiàn)有數(shù)據(jù)會修改原來的數(shù)據(jù)
- 數(shù)組A,去重后生成數(shù)組B,原數(shù)組A的值發(fā)生了改變
- 對象賦值,清空后,原對象改變
示例:let obj2 = { a: 1 }
let obj = obj2
obj = {}
則 obj2 = {} (obj清空導致obj2清空)
- 解決辦法:
采用深拷貝的方法 :
let obj2 = JSON.parse(JSON.stringify(obj1))
https://www.cnblogs.com/guangzhou11/p/11498166.html
三十一、
vue.js:634 [Vue warn]: Unknown custom element: <CustomPageHeaderIndex> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
報錯原因1:一個vue文件里寫了兩個
components: {
},
解決辦法:刪除一個報錯原因2:組件引用,加了大括號
import { CustomPageHeaderIndex } from '@/components/customPageHeader/index.vue';
解決辦法:去掉括號
import CustomPageHeaderIndex from '@/components/customPageHeader/index.vue';