未捕获的类型错误:不能读取属性'1'
Uncaught TypeError: Cannot read property '1'
我有一个问题,只在chrome中出现,在firefox中正常工作没有问题
computedStyle = getComputedStyle(element, ':before');
content = computedStyle.getPropertyValue('content').slice(1, -1);
// content --> NULL
matchResult = content.match(/^'s*('d+)(?:'s?'.(.+))?'s*$/);
if (matchResult) {
numberOfColumns = matchResult[1];
columnClasses = ((_ref = matchResult[2]) != null ? _ref.split('.') : void 0) || ['column'];
} else {
matchResult = content.match(/^'s*'.(.+)'s+('d+)'s*$/);
columnClasses = matchResult[1]; // <-- Error here
numberOfColumns = (_ref1 = matchResult[2]) != null ? _ref1.split('.') : void 0;
}
return {
numberOfColumns: numberOfColumns,
columnClasses: columnClasses
};
};
add_columns = function(grid, items) {
var columnClasses, columnsFragment, columnsItems, i,
和console中的error is Uncaught TypeError: Cannot read property '1' of null
// ...
if (matchResult) {
numberOfColumns = matchResult[1];
columnClasses = ((_ref = matchResult[2]) != null ? _ref.split('.') : void 0) || ['column'];
} else if (matchResult = content.match(/^'s*'.(.+)'s+('d+)'s*$/)){
columnClasses = matchResult[1]; // <-- Error here
numberOfColumns = (_ref1 = matchResult[2]) != null ? _ref1.split('.') : void 0;
} else {
columnClasses = numberOfColumns = null;
}
// ...
在处理数据之前,请确保matchResult
不是null
相关文章:
- TypeError:无法读取属性'推'未定义的JavaScript
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 未捕获的类型错误:无法读取属性'删除'的未定义
- AngularJS指令出错-无法读取属性'编译'的未定义
- 未捕获的类型错误:无法读取属性'name'即使它存在,也无法定义
- 看到“;未捕获的类型错误:无法读取属性'weight'未定义的“;尽管按照字面上的指示
- 无法读取属性'材料'未定义的Three.js
- 得到"TypeError:无法读取属性'filename'未定义的“;调用“npm start
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 未捕获的类型错误:无法读取属性'addEventListener'的null chrome扩展名
- Soundcloud Javascript SDK 3.0-回调无法读取属性'connectCallback
- 未捕获的类型错误:无法读取属性'状态'在react中为null
- JavaScript承诺-无法读取属性'那么'的未定义
- Javascript Float32数组抛出无法读取属性'0'即使数组定义良好,也为null
- 未捕获的类型错误:无法读取属性'中止'的未定义
- 角度推入数组给出:TypeError:无法读取属性'推'的未定义
- http/rxjs catch回调中的Angular 2重定向导致TypeError:无法读取属性'订阅'
- Javascript未捕获类型错误:无法读取属性'0'的未定义
- jQuery控制台错误:无法读取属性'top'的未定义
- TypeError:无法读取属性'findAll'的未定义