社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
1.Method “XXX” has already been defined as a data property.
原因:函数名与data数据里的变量名重复了。
解决方案:修改函数名或修改data里的变量名即可。
2.Property or method “transitionZoom” is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
原因:因为字符串没有加引号,所以解析成变量了。
解决方案:加上引号即可。
3.使用插槽时,子组件没有渲染出来。
原因:对插槽定义理解错误,语法写错了。
解决方案:按照正确语法编写即可。
4.Missing required prop: “value”。
原因:el-input、el-select数据没有绑定,页面缺少value值。
解决方案:在el-input、el-select使用v-model绑定value值即可。
5.Error in render: “TypeError: Cannot read property ‘call’ of undefined”
原因:
解决方案:
6.Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”。
原因:mouted加载table数据以后,隐藏的弹出框并没有编译渲染紧DOM里,所以click弹出$refs并没有获取到DOM元素,导致'resetFields' of undefined。
解决方案:
方案1:
this.$nextTick(() => {
this.$refs[formName].resetFields();
})
方案2:
if(this.$refs[formName] !=== undefined) {
this.$refs[formName].resetFields();
}
7.Invalid value for option “methods”: expected an Object, but got Function.
原因:
解决方案:
8.Invalid prop: type check failed for prop “rowStyle”. Expected Object, Function, got String.
原因:elementUI表格,中该变量需要一个对象或者方法,而你给他的是一个string。
解决方案: 定义一个对象或方法,将其填进:row-style="RowStyle"。
9.Error in created hook: “[object Object]”.
原因:这是它的一个生命周期钩子函数,就是一个vue实例被生成后调用这个函数。一个vue实例被生成后还要绑定到某个html元素上,之后还要进行编译,然后再插入到document中。每一个阶段都会有一个钩子函数,方便开发者在不同阶段处理不同逻辑。一般可以在created函数中调用ajax获取页面初始化所需的数据。 “vue error in created hook”的中文翻译为“创建挂钩时出错”。
解决方案
:
10.Getter is missing for computed property “databankslot”.
原因:将components写成computed了,所以报错。
解决方案:改成components即可。
11.v-for循环动态绑定img的src不成功。img的src属性填写的图片地址可以正常渲染,但使用 :src
属性就加载失败。
原因:图片的路径不对。
解决方案1:使用common写法,即使用require写法。
imgsrc: rquire('@/assets/img.jpg')
解决方案2:本地开发的时候,因为域名是http://localhost:8080,也就是/,vue自动帮你转换成相对/路径。 build的时候,vue默认把图片路径指定在/下。图片地址也就是在/img/xxx.jpg。 如果项目部署在域名是http://www.aaa.com/vue/,/img/xxx.jpg自然找不到图片。 我们build的时候需要指定一个路径/vue/,因为vue/img/xxx.jpg是正确的路径。 修改vue.config.js配置即可。
作者:草珊瑚_6557
链接:https://www.jianshu.com/p/561683dfdbb4
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
12.Missing required prop: “index”.
原因:使用el-submenu时,index=""属性漏写。
解决方案:在el-submenu上添加index=""属性即可。
13.el-dialog遮罩层在对话框上面。
原因:若el-dialog弹出框设置了modal-append-to-body='true'(默认)属性,它的遮罩层就会被插入到body标签下(即与组件所在的最外层div同一层级)。经过分析源代码可得,el-dialog的显示层和遮罩层都设置了position:fixed,当然显示层的z-index肯定要比遮罩层的大,才能正常的显示弹出框。问题就出在此处,若el-dialog的父级也设置了position:fixed,并且其z-index比弹出框的遮罩层的小(遮罩层处于更高一层),那么弹出框的内容就会被遮罩层所遮挡住了。
解决方案:给el-dialog设置modal-append-to-body=“false”,使遮罩层插入至 Dialog 的父元素上。
14.Error in render: “TypeError: Cannot read property ‘height’ of undefined”.
原因:
解决方案:
15.Scripts may close only the windows that were opened by it
原因:脚本只能关闭它所打开的窗口,原因是浏览器基于安全策略限制了脚本关闭非它所打开的窗口机制。
解决方案:此项目可以通过调用$store中的数据和方法进行删除。
this.$store.commit("deleteTabs", this.activeIndex);
this.$store.commit("setActiveIndex", this.openTab[this.openTab.length-1].route);
this.$router.push({ path: this.activeIndex })
16.Cannot read property ‘validate’ of undefined.
原因1: 传值时formName忘了加引号 。
解决方案1:传参需要加引号submit('formName')。
原因2: 传值时是添加了引号,但传递的值与ref的值不一致
解决方案2:传值时添加引号,并保证this.$refs[formName].validate()与ref中的一直。
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!