mapCtx.includePoints API 只能通过点击事件调用?
发布于 6 年前 作者 yong33 5297 次浏览 来自 问答

想在onLoad中调用,提示

VM3568:1 thirdScriptError

Cannot read property ‘includePoints’ of undefined;at pages/index/index page lifeCycleMethod onLoad function

TypeError: Cannot read property ‘includePoints’ of undefined

    at s.onLoad (http://127.0.0.1:32768/appservice/pages/index/index.js:1167:16)

    at s.

(http://127.0.0.1:32768/appservice/dev/WAService.js:1:979296)

    at s.__callPageLifeTime__ (http://127.0.0.1:32768/appservice/__dev__/WAService.js:1:979050))

    at kt (http://127.0.0.1:32768/appservice/__dev__/WAService.js:1:998756))

    at http://127.0.0.1:32768/appservice/__dev__/WAService.js:1:1001435

    at It (http://127.0.0.1:32768/appservice/__dev__/WAService.js:1:1001498))

    at Function.

(http://127.0.0.1:32768/appservice/dev/WAService.js:1:1002450)

    at Be.

(http://127.0.0.1:32768/appservice/dev/WAService.js:1:974690)

    at Be.emit (http://127.0.0.1:32768/appservice/__dev__/WAService.js:1:333900))

    at Object.emit (http://127.0.0.1:32768/appservice/__dev__/WAService.js:1:353303))

,点击是调用好使,在onLoad中就报错,请问什么原因?

this.mapCtx.includePoints({

padding: [10],

points: [{

latitude: latitude,

longitude: longitude,

}, {

latitude: endlat,

longitude: endlng,

}]

});

回到顶部