一、
TypeError:_self。$ scopedSlots.default不是renderCell的函数
(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 数组/对象的默认值应当由一个工厂函数返回
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期待传入数组,传入的却是字符串。类型错误
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 重新下载一遍,再执行 npm install
https://www.cnblogs.com/drizzle-wen/p/8117607.html
十、
vue组件中 style报错 Newline required at end of file but not found
- 原因:项目中使用了eslint,且定义了文件规范,最后一行需要空行
解决办法: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/忽略文件中的所有警告。“
- 解决办法:
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层数太多了,改一下,改为一层,改为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开发中v-for在Eslint的规则检查下出现:Elements in iteration expect to have 'v-bind:key' directives
- 原因: VScode编辑器vue开发过程中,因为安装了ESLint插件,对vue进行了eslint检查,只需将这个规则检查屏蔽掉即可
https://blog.csdn.net/jagger_guo/article/details/78942692
十九、
vue报错Cannot read property 'addEventListener' of null"
- 原因:获取id元素的时候没有获取到,页面中的这个id元素不是在dom加载完成之后动态添加上去的。
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 不会产生该文件,仍可能会发生报错)
element-ui/lib/theme-chalk里面创建了postcss.config.js文件,内容为:
module.exports = {}
https://blog.csdn.net/weixin_43249693/article/details/84766441
- 解决办法(永久有效):
根目录下创建postcss.config.js文件,内容为:
module.exports = {
plugins: {
'autoprefixer': {browsers: 'last 5 version'}
}
}
https://blog.csdn.net/jokren/article/details/86065217
二十一、
在图片地址src不变的情况下,浏览器重新加载图片失败,图片未刷新
- 原因:在src不变时,浏览器直接就去读取缓存
- 解决办法:在图片路径上拼接一个随机数,可以读取到图片路径的变化,重新加载图片
var img_src ='http://www.ilsea.net/images/seagull.jpg?t='+Math.random();
https://blog.csdn.net/maoxunxing/article/details/40618617
二十二、
setInterval只执行一次
- 解决办法:
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服务未启动
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/" }
- 重复命名路由,在路由配置文件中,找到对应name,会发现有两处或者两处以上都使用了“模板”这个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.
- 翻译:数据属性“record”已声明为prop。 请改用prop默认值。即,子组件接收父组件值得时候已经用了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赋值后,改变现有数据会修改原来的数据
- 数组A,去重后生成数组B,原数组A的值发生了改变
- 对象赋值,清空后,原对象改变
示例: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';