You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
报以下错误:
TypeError: Cannot read property 'layerStyle' of null
at i._insertIframeMap (:11120/pageframe/dev/WAWebview.js:2)
at window.__map_jssdk_init (:11120/pageframe/dev/WAWebview.js:2)
at eval (eval at (mapapi.qq.com/jsapi_v2/2/4/132/main.js:1), :1:21)
at mapapi.qq.com/jsapi_v2/2/4/132/main.js:1
相关平台
微信小程序
小程序基础库: 2.11.3
使用框架: React
复现步骤
新建一个页面,使用 <Map />组件,根据Taro代码提示,给Map组件添加必要的 经纬度 属性值,例如:
<Map longitude={116.38} latitude={39.90} />
此时页面不报错,编译正常,但是在微信调试工具里访问该页面,则会报错误:Cannot read property 'layerStyle' of null
解决方式:给Map 组件添加一个 setting的值,哪怕是一个空对象({})也可以,将上面代码修改为:
<Map longitude={116.38} latitude={39.90} setting={{}} />
修改之后再编译,微信调试则地图不报错误。
期望结果
期望正常展现地图。
实际结果
报以下错误:
TypeError: Cannot read property 'layerStyle' of null
at i._insertIframeMap (:11120/pageframe/dev/WAWebview.js:2)
at window.__map_jssdk_init (:11120/pageframe/dev/WAWebview.js:2)
at eval (eval at (mapapi.qq.com/jsapi_v2/2/4/132/main.js:1), :1:21)
at mapapi.qq.com/jsapi_v2/2/4/132/main.js:1
SystemError (webviewScriptError)
Cannot read property 'layerStyle' of null
TypeError: Cannot read property 'layerStyle' of null
at i._insertIframeMap (http://127.0.0.1:11120/__pageframe__/__dev__/WAWebview.js:2:1124471)
at window.__map_jssdk_init (http://127.0.0.1:11120/__pageframe__/__dev__/WAWebview.js:2:1121728)
at eval (eval at (https://mapapi.qq.com/jsapi_v2/2/4/132/main.js:1:61434), :1:21)
at https://mapapi.qq.com/jsapi_v2/2/4/132/main.js:1:61434
Uncaught
环境信息
补充信息
希望能够修改 @tarojs/components/types/Map.d.ts 中 onTap,将 setting 改为必需项,以获得TS的语法检查。
或者给 Map 组件默认加上 setting 属性,不用再手工添加。
The text was updated successfully, but these errors were encountered: