map组件在实机无法正常显示
发布于 4 年前 作者 jpan 3768 次浏览 来自 问答

目前需求:

页面需要用wxparse加载html 然后在页面中显示地图定位

场景1:

wxparse加载完成后 地图在开发工具能正常显示

但是实机测试无法正常显示

场景二:

我尝试把wxparse先关闭不加载 在开发工具能正常显示

实机也能显示 但位置出问题了

wxml如下

<view class=‘article-detail’>

<template is=“wxParse” data="{{wxParseData:html.nodes}}" />

</view>

<view class=‘map-content’ >

<map bindtap=‘openMap’ longitude=’{{addressLongitude}}’ latitude=’{{addressLatitude}}’ markers=’{{mapMarkers}}’></map>

<view bindtap=‘openMap’ class=‘address-detail’>

<text>{{addressDetail}}</text>

</view>

</view>

js如下

wx.request({

url: ‘testurl’,

data: {

id: options.articleId,

userId: app.globalData.userId

},

success: function (res) {

 

_self.setData({

addressLongitude: res.data.articlesInfo.longitude,

addressLatitude: res.data.articlesInfo.latitude,

addressDetail: res.data.articlesInfo.address,

mapMarkers: [

{

id: 0,

longitude: res.data.articlesInfo.longitude,

latitude: res.data.articlesInfo.latitude,

iconPath: ‘/images/map-marker.png’,

width: 39,

height: 51,

}

]

});

WxParse.wxParse(‘html’, ‘html’, _self.data.articleDetail, _self, 14);

}});

求大哥们解答…

2 回复

有人吗…官方呢…

挺急的 有没有人回答一下?

回到顶部