添加地图后显示空白
来源:1-1 框架的选择
慕运维7552360
2021-11-19 21:31:58
请问在index.wxml index.ts中添加map地图,去除logs后,为什么我的开发工具显示报错
index.wxml如下:
<map
id ="map"
latitude ="{{location.latitude}}"
longitude="{{location.longitude}}"
scale = "{{scale}}"
setting= "{{setting}}"
enable-enable-overlooking="{{isOverLooking}}"
enable-3D="{{is3D}}"
markers="{{markers}}"
></map>
index.ts如下:
// index.ts
// 获取应用实例
Page({
data: {
setting : {
skew: 0,
rotate: 0,
showLocation: true,
showScale: true,
subKey: '',
layerStyle: 1,
enableZoom: true,
enableScroll: true,
enableRotate: false,
showCompass: false,
enable3D: false,
enableOverlooking: false,
enableSatellite: false,
enableTraffic: false,
},
location:{
latitude:29.756825521115363,
longitude:121.87222114786053,
},
scale:19,
markers:[
{
iconPath:"/resources/car.png",
id:0,
latitude:23.099994,
longitude:113.32452,
width:50,
height:50
},
{
iconPath:"/resources/car.png",
id:1,
latitude:23.099994,
longitude:114.32452,
width:50,
height:50
},
]
},
})
app.json如下:
{
"pages": [
"pages/index/index"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "测试",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
1回答
ccmouse
2021-11-23
抱歉遗漏了这个问题。我这边试了一下同学的代码是正常的。我记得以前也遇到过,重启开发工具或者重启电脑可以解决。若还是不行可以使用小程序代码片段功能把代码发到我这边。方法请参考https://class.imooc.com/lesson/1765#mid=40805 视频4分钟左右的小程序代码片段。
相似问题