- 37
- 0
Error in callback for watcher "center": "TypeError: Cannot read property 'centerAndZoom' of undefined"
Cannot read property 'centerAndZoom' of undefined
为什么一直报undefined
<div id="map">
<baidu-map class="bm-view" ak="fKU9vX6h1mmAiuiopj7aLSx14VK4ZELq" id="allmap" :center="center" :zoom="zoom" @ready="handler">
</baidu-map>
</div>
handler ({ BMap, map }) {
setTimeout(() => {
map = new BMap.Map("allmap")
// var point = new BMap.Point(116.331398, 39.897445)
// map.centerAndZoom(point, 12);
var local = new BMap.LocalSearch(map, {
renderOptions: { map: map }
});
local.search(this.infoDetails.city);
}, 260);
}, 1
打赏
收藏
点击回答
您的回答被采纳后将获得:提问者悬赏的 11 元积分
- 共 0 条
- 全部回答
-
野の 普通会员 1楼
If you are using the
centerAndZoommethod of the Baidu Maps API and the method is returningundefined, it means that the method is not recognized by your application. There are a few reasons why this could be the case:- The method may not be supported by your application. Make sure that you are using the latest version of Baidu Maps API and that the method is available in your application's code.
- The method may have been removed from the API. If the method is no longer available in the API, you will need to find a way to calculate the center and zoom of a map without it.
- There may be an issue with your application's configuration. Make sure that your application is configured correctly and that the correct credentials are being used.
To troubleshoot this issue, you can try the following:
- Check if the method is available in your application's code. You can do this by searching for the method in your code and verifying that it is implemented correctly.
- Check if the method is supported by your application. You can do this by testing the method with a Baidu Maps API key and verifying that it returns the expected result.
- Check if your application's configuration is correct. You can do this by reviewing your application's code and verifying that the correct credentials are being used.
If none of these steps help, please provide more information about your application and the Baidu Maps API you are using.
更多回答
网站公告
- 扫一扫访问手机版
回答动态

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器更新之后。服务器里面有部分玩家要重新创建角色是怎么回事啊?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题函数计算不同地域的是不能用内网吧?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题ARMS可以创建多个应用嘛?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题在ARMS如何申请加入公测呀?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题前端小程序接入这个arms具体是如何接入监控的,这个init方法在哪里进行添加?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器刚到期,是不是就不能再导出存档了呢?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器的游戏版本不兼容 尝试更新怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器服务器升级以后 就链接不上了,怎么办?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器转移以后服务器进不去了,怎么解决?预计能赚取 0积分收益

- 神奇的四哥:发布了悬赏问题阿里云幻兽帕鲁服务器修改参数后游戏进入不了,是什么情况?预计能赚取 0积分收益
- 回到顶部
- 回到顶部
