Uncaught TypeError: Cannot read property 'tabs' or '' of undefined
来源:互联网 发布:如何清理淘宝缓存 编辑:程序博客网 时间:2024/06/08 03:52
在使用easyUI做项目时,会使用到它的样式类,但是在使用的时候会出现一些莫名的错误:
比如:
看到报错的地方不认识,就觉得应该是使用的方法有问题。于是去看了下源码,它定义的方法也真的是挺无语的:
我们来看看_376是怎么定义的呢:
似乎我们看到了.tabs,控制台的错误提示也确实是property is undefined的,undefined出现的原因就那么几种,
- 对象中没有这个属性,或者你没有定义这个变量,就直接来拿使用
- 你没有定义这个对象,最常见的是没有var data = {};而你就直接使用data.property = "'; 等
似乎从这个方法里面我们还看不出来什么,那就需要看一下这个_37a是什么东西
function _376(_37a, _37b, _37c) { var tabs = $.data(_37a, "tabs").tabs; var tab = null; if (typeof _37b == "number") { if (_37b >= 0 && _37b < tabs.length) { tab = tabs[_37b]; if (_37c) { tabs.splice(_37b, 1); } } } else { var tmp = $("<span></span>"); for (var i = 0; i < tabs.length; i++) { var p = tabs[i]; tmp.html(p.panel("options").title); if (tmp.text() == _37b) { tab = p; if (_37c) { tabs.splice(i, 1); } break; } } tmp.remove(); } return tab; };
一点一点往上找,我们会看到:
在上面的方法中我们可以看到这个:div.tabs-header这个样式,于是我们就可以猜一下,是不是DOM元素没有
这个东西,才导致一系列的undefined呢,我把div中的class="easyui-tabs"样式去掉:
通过审查元素,可以看到,确实没有,它不像tree这个组件,你只要定义个div并绑定id就行,而这个不行。
然后我们把class样式加上后,发现确实是这样的:
阅读全文
0 0
- Uncaught TypeError: Cannot read property 'tabs' or '' of undefined
- easyui 异常:Uncaught TypeError: Cannot read property 'tabs' of undefined
- Extjs4---Uncaught TypeError: Cannot read property ‘items’ of undefined
- 【StackFlow】Uncaught TypeError: Cannot read property 'pageCount' of undefined
- Ckeditor: Uncaught TypeError: Cannot read property 'keyCode' of undefined 解决方法
- Uncaught TypeError: Cannot read property 'msie' of undefined问题解决方案
- Uncaught TypeError: Cannot read property 'options' of undefined 错误
- Uncaught TypeError: Cannot read property 'length' of undefined
- 错误:Uncaught TypeError: Cannot read property 'WebSocket' of undefined
- Uncaught TypeError: Cannot read property 'value' of undefined
- Uncaught TypeError: Cannot read property 'plugin' of undefined
- react Uncaught TypeError: Cannot read property 'title' of undefined
- Uncaught TypeError: Cannot read property 'width' of undefined
- Uncaught TypeError: Cannot read property 'substring' of undefined
- Uncaught TypeError: Cannot read property 'PRINT_INIT' of undefined user:100
- Uncaught TypeError: Cannot read property 'substring' of undefined
- extjs4:Uncaught TypeError: Cannot read property 'processed' of undefined
- Datatables 之Uncaught TypeError: Cannot read property 'mData' of undefined
- 区块链数字货币资产交易平台开发搭建
- ThinkPHP中驼峰命名模板找不到bug
- 做程序员的日子
- Monte Carlo method——现代工程支柱
- RabbitMQ 入门 Helloworld
- Uncaught TypeError: Cannot read property 'tabs' or '' of undefined
- 网络分级设计模型:核心层、汇聚层和接入层
- FreeBASIC学习笔记——1.2 编译器简介FireFly
- 去掉CSDN使用MarkDown编辑器插入图片自动添加的水印
- jsp页面equal symbol expected异常
- Base64
- 阶段一:2017年最新Elasticsearch入门核心知识视频教程
- storm与spark streaming反压机制
- Pycharm 2017 激活码