vue报错信息
1.Property or method "xxx" is not defined on the instance but referenced during render.
原因:xxx在template或方法中使用了,但是没有在data中定义
2.can not read property ‘xxx’ of undefined 和 can not read propery ‘xxx’ of null
原因:因为 调用这个xxx方法的对象 的数据类型是undefined,所以无法调用报错。类似的报错还有Cannot read property 'xxx' of null 调用方法的对象是null,也是无法调用报错
3.Error in render function: "Type error"
注意,只要出现Error in render,即渲染时候报错,此时应该去渲染位置去找错误,而不是函数里面。
4.Error: listen EADDRNOTAVAIL 192.168.3.83:3030
5.Computed property "xxx" was assigned to but it has no setter.
<template>
<div id="app">
<div>{{number}}</div>
</div>
</template> <script>
export default {
computed:{
number(){
return 123
}
},
created(){
this.number=234; //this.number 是定义再computed的方法函数,不能直接使用修改属性的方式修改
}
}
</script>
6.Duplicate keys detected: '8'. This may cause an update error. 错误
主要时绑定的key出现了重复
看错误的的报告中关键字’keys’,联系错误的时机,可以知道这个错误出现在我使用vue的循环中,循环再vue或者小程序中饭为了保证每一项的独立性,都会推荐使用key,所以综上所述,很可能是key出现问题
很显然后几个的index重复了,所以修改index后,就不再出现此问题了。
7.[Vue warn]: Error in render: "TypeError: Cannot read property 'title' of null"
<template>
<section class="book-info" >
<div class="book-detail">
<h2 class="book-title">{{ book.title }}</h2>
</div>
</section>
</template> <script>
export default {
data(){
return{
book:null
}
},
created(){
http.getBook(this.currentBook.id)
.then(data=>{
this.book=data
console.log(data)
})
}
}
</script>
解决方法
方法1.设置 book类型由null改为Object
data(){
return{
book:Object
}
},
方法2.设置v-if="book !== null"
<template>
<section class="book-info" v-if="book !== null">
<div class="book-detail">
<h2 class="book-title">{{ book.title }}</h2></p>
</div>
</section>
</template> <script>
export default {
data(){
return{
book:null
}
},
created(){
http.getBook(this.currentBook.id)
.then(data=>{
this.book=data
console.log(data)
})
}
}
</script> <style lang="scss" scoped> </style>
vue报错信息的更多相关文章
- vue报错There are multiple modules with names that only differ in casing. This can lead to unexpected behavior when compiling on a filesystem with other case-semantic. Use equal casing. Compare these mod
今天在开发一个新项目时,当安装完依赖包启动项目后报了一个这个错 There are multiple modules with names that only differ in casing.Thi ...
- Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')
Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...
- SVN Cornerstone 报错信息 xcodeproj cannot be opened because the project file cannot be parsed.
svn点击update 之后,打开xcode工程文件,会出现 xxx..xcodeproj cannot be opened becausethe project file cannot be p ...
- PHP安全编程:不要让不相关的人看到报错信息
没有不会犯错的开发者,PHP的错误报告功 能可以协助你确认和定位这些错误,可以提供的这些错误的详细描述,但如果被恶意攻击者看到,这就不妙了.不能让大众看到报错信息,这一点很重要.做到这一 点很容易,只 ...
- SQL 报错信息整理及解决方案(持续更新)
整理一下自己遇见过的 SQL 各种报错信息及相应解决方法,方便以后查阅,主要平台为 Oracle: ORA-01461: 仅能绑定要插入 LONG 列的 LONG 值: 原因:插入操作时,数据大于字段 ...
- JavaWeb:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.新建的jsp页面,添加一个简单的Java类.可是,JSP页面顶端出现“红色”的报错信息:The superclass & ...
- tomcat部署新的项目的时候出现报错信息: Invalid byte tag in constant pool: 15
上面一堆tomcat启动的提示信息省略掉,下面是报错的具体信息:org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid ...
- PHP安全编程:不要让不相关的人看到报错信息(转)
没有不会犯错的开发者,PHP的错误报告功能可以协助你确认和定位这些错误,可以提供的这些错误的详细描述,但如果被恶意攻击者看到,这就不妙了.不能让大众看到报错信息,这一点很重要.做到这一点很容易,只要关 ...
- JAVA_用_JCO连接_SAP,实现调用SAP_的_RFC_函数(整理)(附一篇看起来比较全面的说明)(JCO报错信息)
// 获取RFC返回的字段值 11 JCoParameterList exportParam = function.getExportParameterList(); 12 String exPara ...
随机推荐
- Python基于dtw实现股票预测【多线程】
# -*- coding: utf-8 -*- """ Created on Tue Dec 4 08:53:08 2018 @author: zhen "&q ...
- chmod命令-权限
---··[转] hmod命令:改变文件权限. 一:符号模式: 命令格式:chmod [who] operator [permission] filename who包含的选项 ...
- js 实现动态时间
<span id="timebox"></span> //承载时间的span $(function () { var o ...
- Linux 安装golang
访问官方下载地址 或 https://studygolang.com/dl ,32位系统下载go1.9.4.linux-386.tar.gz,64位系统下载go1.9.4.linux-amd64.ta ...
- 函数指针的返回值是指针数组,数组里放的是int;函数指针的返回值是指针数组,数组里放的是int指针
函数指针的返回值是指针数组,数组里放的是int 函数指针的返回值是指针数组,数组里放的是int指针 #include <stdio.h> #include <stdlib.h> ...
- 安全之路 —— 利用APC队列实现跨进程注入
简介 在之前的文章中笔者曾经为大家介绍过使用CreateRemoteThread函数来实现远程线程注入(链接),毫无疑问最经典的注入方式,但也因为如此,这种方式到今天已经几乎被所有安全软件所防御.所以 ...
- Linux:固定 ip
默认情况下,安装完操作系统时,ip是采用dhcp来动态分配的.通常我们需要将其固定下来. 不然 每次系统重启后,ip都会变动,这样会给日常工作带来不必要的麻烦的. 下面就是在rhel .centos ...
- 【PAT】B1007 素数对猜想
素数筛筛出规定范围内的所有素数存入数组 遍历数组,如果满足于后边的差2,计数器加加 #include <cstdio> const int maxn = 10000001; int pri ...
- 【算法】LeetCode算法题-Count And Say
这是悦乐书的第153次更新,第155篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第12题(顺位题号是38).count-and-say序列是整数序列,前五个术语如下: ...
- 《Java大学教程》—第15章 异常
自测题:1. 什么是异常?P357异常是在程序生命周期内出现的事件,它会导致程序行为不可靠. 2. 已检查异常和未检查异常的区别是什么?P359在编译器允许程序被编译通过前,要求程序员必须编写代 ...