home:76 Uncaught TypeError: AMap.MouseTool is not a constructor
利用高德地图API标记已知点并测量已知点之间的距离,在调用高德地图的类方法的时候会遇到这样的问题
home:76 Uncaught TypeError: AMap.MouseTool is not a constructor
这是因为前端没有不认识这个方法(MouseTool)是高德地图的类,所以一直找不到这个方法。
解决方法是让前端知道这个方法是高德地图的内置类,代码如下:
AMap.plugin(["AMap.MouseTool"],function () {
mouseTool = new AMap.MouseTool(map);
});
还要记住一点,在这个函数中不需要声明(var)mouseTool这个变量 ,直接使用,具体原理我也不太明白。
我太难了,这个问题改了2天。

home:76 Uncaught TypeError: AMap.MouseTool is not a constructor的更多相关文章
- Uncaught TypeError: o.a is not a constructor
最近在学webpack打包工具,看着挺好玩的,虽然也是工作需要 首先安装啥的我就不说了,后面慢慢写,打包完了以后,运行代码发现提示这个 找半天代码没问题啊,我这个js基础薄弱的人用这个webpack还 ...
- SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 SignalR 简单示例 通过三个DEMO学会SignalR的三种实现方式 SignalR推送框架两个项目永久连接通讯使用 SignalR 集线器简单实例2 用SignalR创建实时永久长连接异步网络应用程序
SignalR代理对象异常:Uncaught TypeError: Cannot read property 'client' of undefined 推出的结论 异常汇总:http://www ...
- Uncaught TypeError: Cannot read property 'msie' of undefined
因为图方便,抄了别人写的一个jquerry插件,运行时“var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ...
- 360浏览器Uncaught TypeError: object is not a function问题
刚刚360浏览器提示 Uncaught TypeError: object is not a function,找了半天发现问题是我有一个按钮,id和方法重复了,所以提示这个. <input t ...
- Jquery报错:Uncaught TypeError: ((m.event.special[e.origType] || (intermediate value)).handle || e.handler).apply is not a function
页面中出现了Jquery报错:Uncaught TypeError: ((m.event.special[e.origType] || (intermediate value)).handle || ...
- [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
我们开发的产品,有一部分功能,需要在WebView中打开web页面,然后在web页面中通过js方法回调部分native的功能. 对于web回调native的开发方式,如果不了解的话,可以参考我以前的一 ...
- jQuery-2.1.4.min.js:4 Uncaught TypeError: Illegal invocation
jQuery-2.1.4.min.js:4 Uncaught TypeError: Illegal invocation 此错误与crsf有关
- Uncaught TypeError: _react2.default.findDOMNode is not a function
react 查找某节点时报错 Uncaught TypeError: _react2.default.findDOMNode is not a function 代码: import React, { ...
- [Android]通过js方法回调部分native报错 Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
在android4.2以前,注入步骤如下: webview.getSetting().setJavaScriptEnable(true); class JsObject { public String ...
- Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null
在开发Ext 项目中如果遇到 Uncaught TypeError: Cannot read property 'insertAdjacentHTML' of null 这个错误,检查下renderT ...
随机推荐
- [Oracle19C ASM管理] 安装和配置ASM以及Oracle数据库
一般设置 关闭防火墙 检查防火墙状态 systemctl status firewalld.service 暂时关闭防火墙,下次启动时防火墙仍随系统启动而启动 systemctl stop firew ...
- Characterizing possible failure modes in physics-informed neural network
NeurIPS 2021 表征PINN中可能的失败模式.本文的思路也比较简单,通过对PINN的优化域进行观察,发现导致PINN训练的原因并不是因为神经网络的表达力不足,而是由于PINN中引入了基于PD ...
- select remove option safari 兼容
select 移除某一 option 的 javascript 公司用的代码是 var ddlPrimaryResource = document.getElementById(ddlPrimaryR ...
- 20220408_转载_LaTex数学公式基本代码
https://blog.csdn.net/ViatorSun/article/details/82826664 超详细 LaTex数学公式
- react 基础知识
基础知识 css-module react 将js转为vdom,react-dom将vdom转为dom // 外面一层是一个动态值,里面的表示的是对象 <img src={logo} style ...
- js中常用的运算符
1. ?. 链接运算符 特性: 一旦遇到空置就会终止 例子: let name = obj?.name persion.getTip?.() // 没有getTip 方法则不会执行 2. ?? 空值合 ...
- spring mvc基本介绍
1 MVC 盖帘: MVC 是模型(model)-视图(view)-控制器(controller)的缩写, 是一种用于设计编写 Web 应用程序表现层的模式. MVC 设计模式的三大角色: Model ...
- vue remark重置 提交
html: <el-table-column prop="remark" label=""> <templat ...
- MySQL 利用时间(秒分时日月年)分组统计
1.统计 七天 前 人数 select count(*) from your_table where last_login_time> date_sub(date(now()), interva ...
- react ref用法更新
react中ref的3种绑定方式 方式1: string类型绑定 类似于vue中的ref绑定方式,可以通过this.refs.绑定的ref的名字获取到节点dom 注意的是 这种方式已经不被最新版的re ...