简体   繁体   English

未捕获的TypeError:r.has不是函数

[英]Uncaught TypeError: r.has is not a function

The only change that i made is that I upgraded to the new version of handsontable; 我所做的唯一更改是我升级到了新版本的handontable。 all other code is the same. 其他所有代码都相同。 Working fine in v15.1, but v16.x or 17.0 both give me the error. 在v15.1中可以正常工作,但是v16.x或17.0都给我错误。 Unfortunately, I am unable to reproduce in fsfiddle. 不幸的是,我无法复制。 Even the most basic example is failing for me: 甚至最基本的例子对我来说都是失败的:

 document.addEventListener("DOMContentLoaded", function() { var container1 = document.getElementById('example1'); var hot1; hot1 = new Handsontable(container1, {}); }); 
 <link type="text/css" rel="stylesheet" href="http://docs.handsontable.com/0.17.0/bower_components/handsontable/dist/handsontable.full.min.css"> <script src="http://docs.handsontable.com/0.17.0/bower_components/handsontable/dist/handsontable.full.js"></script> <div id="example1"></div> 

This should display a blank grid (and does in jsfiddle), but in my environment i get the error. 这应该显示一个空白网格(并且在jsfiddle中也是如此),但是在我的环境中,我得到了错误。 Any thoughts? 有什么想法吗?

I don't know what environment you are working in, but I was able to identify the reason for this error in VisualForce. 我不知道您在什么环境中工作,但是我能够在VisualForce中确定此错误的原因。

The same problem happened: handsontable was upgraded from version 15 to version 20 and the page stopped working with similar error: 发生了相同的问题:Handsontable已从版本15升级到版本20,并且页面停止工作并出现类似错误:

TypeError: samples.has is not a function. 

Variable samples is initialized in handsontable.full.js as: var samples = new Map(); 变量样本在handsontable.full.js中初始化为:var samples = new Map(); and the variable Map was getting overwritten by Salesforce main.js. 并且变量Map被Salesforce main.js覆盖。

I've replaced Map with hotMap through out handsontable.full.js and page is working now. 我已经通过handsontable.full.js将地图替换为hotMap,并且页面正在运行。

It looks like you have the conflict with variables from different included js files in your environment too. 看起来您也与环境中其他包含的js文件中的变量存在冲突。

Not good that I had to change handsontable.full.js of course but could not think of anything else. 当然我不得不更改handsontable.full.js不好,但是没有想到其他任何事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM