wx.canIUse() for mapContext's getRegion?
发布于 5 年前 作者 tding 5642 次浏览 来自 问答

I cannot use wx.canIUse(‘createMapContext.return.getRegion’) in which it always return false. It should return true as I tested with SDKVersion > 1.4.0.

Is this a bug? or I use it wrong?

2 回复

Thank you. It’s also good alternative way, I took note of it.

I just found out that it works if I use

wx.canIUse('mapContext.getRegion')

Problem solved now.

u should invoke `wx.createMapContext()` to get a MapContext object, then use `if`.

suck as:

var context = wx.createMapContext(mapId);

if (context.getRegion) {

  // supported

} else {

  // not supported

}

回到顶部