遇到问题了,我调用百度地图的api但是用不了,我看教程上申请是可以用的
发布于 5 年前 作者 uxiong 4827 次浏览 来自 问答

我还去百度弄了位置定位的ak,但是用不了一直报错,有没有更加好的办法呢

WAService.js:3 thirdScriptError

Cannot read property ‘addressComponent’ of undefined;at pages/main/main loadCity function;at api request success callback function

TypeError: Cannot read property ‘addressComponent’ of undefined

    at Function.success (http://127.0.0.1:9973/appservice/pages/main/main.js:48:35)

    at Object.success (http://127.0.0.1:9973/appservice/__dev__/WAService.js:3:10625)

    at s.<anonymous> (http://127.0.0.1:9973/appservice/__dev__/WAService.js:8:2159)

    at s.emit (http://127.0.0.1:9973/appservice/__dev__/WAService.js:4:16328)

    at Function.<anonymous> (http://127.0.0.1:9973/appservice/__dev__/WAService.js:8:3507)

    at http://127.0.0.1:9973/appservice/__dev__/WAService.js:4:1529

    at d (http://127.0.0.1:9973/appservice/appservice:1135:7042)

    at b.<anonymous> (http://127.0.0.1:9973/appservice/appservice:1135:7122)

    at b.emit (http://127.0.0.1:9973/appservice/appservice:1135:19527)

    at callback (http://127.0.0.1:9973/appservice/appservice:1135:12987)

errorReport @ WAService.js:3

thirdErrorReport @ WAService.js:3

(anonymous) @ WAService.js:3

(anonymous) @ WAService.js:8

s.emit @ WAService.js:4

(anonymous) @ WAService.js:8

(anonymous) @ WAService.js:4

d @ appservice:1135

(anonymous) @ appservice:1135

b.emit @ appservice:1135

callback @ appservice:1135

setTimeout @ appservice:1135

(anonymous) @ WAService.js:3

setTimeout (async)

setTimeout @ WAService.js:6

h @ appservice:1135

c @ appservice:1135

s.onreadystatechange @ appservice:1135

XMLHttpRequest.send (async)

p @ appservice:1135

createRequestTask @ appservice:1135

a.exports @ appservice:1135

r @ WAService.js:3

c @ WAService.js:3

o @ WAService.js:8

e @ WAService.js:8

u @ WAService.js:8

(anonymous) @ WAService.js:4

loadCity @ main.js? [sm]:39

(anonymous) @ WAService.js:13

success @ main.js? [sm]:33

(anonymous) @ WAService.js:3

(anonymous) @ WAService.js:3

function.setTimeout @ appservice:1135

(anonymous) @ WAService.js:3

setTimeout (async)

setTimeout @ WAService.js:6

m @ appservice:1135

h.registerCallback @ appservice:1135

k.forEach @ appservice:1135

d @ appservice:1135

h.onmessage @ appservice:1135

3 回复

就是说百度申请ak然后用不了,以下是报错信息

Sun Dec 17 2017 19:27:07 GMT+0800 (中国标准时间) request 合法域名校验出错

appservice:1135 如若已在管理后台更新域名配置,请刷新项目配置后重新编译项目,操作路径:“项目-域名信息”

appservice:1135  http://api.map.baidu.com 不在以下 request 合法域名列表中,请参考文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/network-request.html

1、

错误中提示 addressComponent undefined,应该是文件导入有问题

定位确认几个地方:

1、申请的AK正常

2、在request合法域名中加入https域名

3、正确导入js文件

4、百度、腾讯都有定位的接口

我的wx:huadaxia1

回到顶部