map组件 markers icon没有显示
发布于 6 年前 作者 wumin 1748 次浏览 来自 问答

map组件 markers icon设置了没有显示,用原生的也没有显示

7 回复

同遇到这个问题,另外iconPath能不能使用远程链接啊?在开发工具上,使用远程图片显示没问题。在手机上显示成了默认的“红点”icon

我也遇到了,只是在ios下不显示,安卓正常

路径可能有问题

安卓机子可以,苹果不行

同遇到这个问题。。调试面板中的marker可以显示,但是在手机中预览就没了!很奇怪,求解。

<view class=“full-map”>

        <map id=“map” longitude="{{map.longitude}}" latitude="{{map.latitude}}" scale=“15” markers="{{map.markers}}" style=“width: 100%; height: 100%;”></map>

    </view>

Page({

  data:{

    map: {

      longitude: ‘’,

      latitude: ‘’,

      markers: []

    }

  },

  onLoad:function(options){

    // 页面初始化 options为页面跳转所带来的参数

    this.data.map.longitude = options.longitude;

    this.data.map.latitude = options.latitude;

    this.data.map.markers = [{

      iconPath: “…/…/public/img/marker.png”,

      latitude: options.latitude,

      longitude: options.longitude,

      width: 20,

      height: 30

    }];

    this.setData({ map: this.data.map });

  },

  onReady:function(){

    // 页面渲染完成

  },

  onShow:function(){

    // 页面显示

  },

  onHide:function(){

    // 页面隐藏

  },

  onUnload:function(){

    // 页面关闭

  }

})

你代码写的有问题吧!贴出来看看

回到顶部