reportComplaints.js: Uncaught TypeError: Cannot read property 'message' of undefined

vonic 中遇到这么个问题, 一直提示我未定义, 可是明明有定义

var tab={
    message:{
        number:‘‘,
        title:‘‘
    }
}
var id= {
    template: ‘#id‘,
    data: function(){
        return tab;
    },
    created: function () {
        //感觉问题就是这        var self = this;

    },
    methods: {
            showComplaintsDetail:function(item){
                var self = this;
                self.tab.message= item; //这样写就会报那个错误             }    } }

后来发现可能是var self = this; 的问题, 结果去掉后就正常了,或者把tab去掉也可以恢复正常, 感觉就是self获取的this不一样, 有些self中包含tab, 有些包含的是tab中的属性,

这里先简单记一下, 有机会在深入了解

reportComplaints.js: Uncaught TypeError: Cannot read property 'message' of undefined

原文地址:https://www.cnblogs.com/gczmn/p/9152097.html

时间: 2024-08-29 18:26:30

reportComplaints.js: Uncaught TypeError: Cannot read property 'message' of undefined的相关文章

Uncaught TypeError: Cannot read property 'call' of undefined jquery.validate.min.js:28

最近在做表单校验的时候,自己写的addMethod 方法老是不起作用,折腾了接近一天的时间.报的错误如下 Uncaught TypeError: Cannot read property 'call' of undefinedjquery.validate.min.js:28 先来看一下 我自己页面的布局. top.jsp 上面的截图为top.jsp的头部引用的表单校验jquery-1.6.js和jquery.validate.min.js 我来看我自己需要校验的那个页面的jsp布局(stepT

underscore.js定义模板遇到问题:Uncaught TypeError: Cannot read property 'replace' of undefined

代码正确缩进位置如下, extend "layout" block 'content',-> div ->'nihao' script id:"InvoiceItem",type:"text/template",style:"display: none",-> div ->"{{price}}" div ->"{{quantity}}" div ->&

Three.js three.js Uncaught TypeError: Cannot read property 'getExtension' of null

在调试Three.js执行加载幕布的时候,突然爆出这个错误three.js Uncaught TypeError: Cannot read property 'getExtension' of null,查询了半天也没找到结果 最后突然想到是不是浏览器的设置问题,检查了一下WebGL,果然重新安装浏览器之后没有开启,正常开启之后,显示正常 留痕MARK一下 PS:可以直接在百度上搜索浏览器的WebGL的开启方式 :) Three.js three.js Uncaught TypeError: C

Vue ElementUI Axios报错: Uncaught (in promise) TypeError: Cannot read property '$message' of undefined

从头再来!!! 出错的代码如下: login() { this.loading = true let userInfo = {account: this.loginForm.account, password: this.loginForm.password, captcha: this.loginForm.chptcha} this.$api.login.login(userInfo).then( function(res) { if (res.msg != null) { this.$mes

easyui Datagrid查询报错Uncaught TypeError:Cannot read property 'length' of undefined

1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问题,然后从早上干到下午,网上各种方法用尽了就是不行! 最后发现规律了: 使用mybatis从数据库查询返回的List不报错,但是自己new的ArrayList总是报错! 后来发现原来mybatis返回的不是ArrayList!而是PageList! 3.解决问题 PageList中有个参数Pagin

SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论

后台创建了一个DntHub的集线器 前台在调用的时候出现了问题(经检查是代理对象创建失败) 于是到StackOverflow上面找了下: http://stackoverflow.com/questions/14146913/signalr-cannot-read-property-client-of-undefined 上面说改成小写就ok了,很多人也解决成功了 逆天改成小写后也解决了,var chat = $.connection.dntHub 也许很多人就直接忽略了~~~~but,我为什么

jQuery mobile报错 Uncaught TypeError: Cannot read property 'concat' of undefined

写一个jQuery mobile的demo <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="styl

解决discuz与jquery不兼容问题——下拉列表不能用(Uncaught TypeError: Cannot set property &#39;position&#39; of undefined)

问题描述: 最近学着用discuz来模仿一个门户网站,里面要把导航条做出滑动效果,要用到jquery,将要用到jquery引用到header.htm中,如下图所示: 但是由于discuz采用php以及本身的机制,jquery中的$会与discuz本身的common.js和forum.js产生冲突,会出现如下的错误导致下拉列表 解决办法: 解决思路:将jquery的$重新定义一下,比如我门将用jq代表jquery的$ 在jquery-1.7.2.js的末尾加上一句如下代码: var jq = $.

reactjs Uncaught TypeError: Cannot read property &#39;location&#39; of undefined

reactjs Uncaught TypeError: Cannot read property 'location' of undefined reactjs 路由配置 怎么跳转 不成功 国内搜索引擎 找半天找不到 有用 资料 于是 goolge package.json 里面配置: "react-router": "^3.0.0"  改为3.x 就可以了 , 改完 执行 npm install 原文参考: https://github.com/acdlite/r