> 文章列表 > Vue Baidu Map图标旋转rotation失败且控制台一直报错

Vue Baidu Map图标旋转rotation失败且控制台一直报错

Vue Baidu Map图标旋转rotation失败且控制台一直报错

报错如下:

 解决:

/
* ready 地图组件渲染完毕时触发,返回一个百度地图的核心类和地图实例。百度地图组件是异步加载,请不要 * 尝试在组件的生命周期中访问 BMap 核心类和 map 实例,如有需要,请在所需组件的 ready 事件回调函数的* 参数中获取。
*/// html<baidu-map@ready="bMapReady">    </baidu-map>// dataBMap: null, // methods/* @Event 方法* @description:* */bMapReady({BMap, map}) {this.BMap = BMap// console.log(BMap, map, '123123')},/* @Interface 查询运行轨迹* */getPath() {let queryObj = {carId: this.carId,beginTime: this.formData.dateStr + " " + this.formData.timeArr[0],endTime: this.formData.dateStr + " " + this.formData.timeArr[1],};queryLocus(queryObj).then((res) => {if (res.data !== [] && res.data.length > 0) {res.data.forEach((item, index) => {// this.path.push({//   lng: JSON.parse(item.longitude),//   lat: JSON.parse(item.latitude),// });// !!! todo  重点是这个 this.path.push(new this.BMap.Point(item.longitude, item.latitude))});});},

官方文档:Vue Baidu Map