笑望哥
笑望哥
  • 发布:2020-04-03 15:22
  • 更新:2021-06-07 13:49
  • 阅读:780

【报Bug】V3模式map组件云打包后markers丢失

分类:HBuilderX

云打包后markers的图标不显示。iconPath路径有问题,基本是正常的

HBuilderX 2.6.12

两部安卓9手机测试均有该问题。

2020-04-03 15:22 负责人:无 分享
已邀请:
DCloud_uniAD_HDX

DCloud_uniAD_HDX

验证正常,Android系统版本多少?

<template>  
  <view>  
    <map id="map1" class="map" :latitude="latitude" :longitude="longitude" :scale="scale" :controls="controls" :markers="markers"  
      @controltap="controltap" :show-location="true"></map>  
    <button @click="updateCenter">updateCenter</button>  
    <button @click="moveToLocation">moveToLocation</button>  
    <button @click="updateMarker">updateMarker</button>  
    <button @click="getScale">getScale</button>  
    <button @click="getCenterLocation">getCenterLocation</button>  
    <button @click="getRegion">getRegion</button>  
  </view>  
</template>  

<script>  
  export default {  
    data() {  
      return {  
        isShowMap: false,  
        latitude: 31.226487,  
        longitude: 121.430394,  
        scale: 20,  
        markers: [],  
        controls: [{  
          id: 1,  
          position: {  
            left: 15,  
            top: 15  
          },  
          iconPath: '/static/logo.png',  
          clickable: true  
        }]  
      }  
    },  
    onReady() {  
      this.mapContext = uni.createMapContext('map1', this);  
      //this.mapNative = this.mapContext.$getAppMap();  
      //console.log("this.mapNative" + this.mapNative);  
    },  
    methods: {  
      showMap() {  
        this.isShowMap = !this.isShowMap;  
      },  
      controltap(e) {  
        console.log(e.detail.id);  
      },  
      updateCenter(e) {  
        this.latitude = "39.909";  
        this.longitude = "116.39742";  
      },  
      moveToLocation() {  
        this.mapContext.moveToLocation({  
          latitude: 39.909,  
          longitude: 116.39742,  
          success: (res) => {  
            console.log(res);  
          }  
        });  
      },  
      getCenterLocation() {  
        this.mapContext.getCenterLocation({  
          success: (res) => {  
            console.log(res.longitude);  
            console.log(res.latitude);  
          }  
        })  
      },  
      getScale() {  
        this.mapContext.getScale({  
          success: (res) => {  
            console.log(res.scale);  
          }  
        })  
      },  
      getRegion() {  
        this.mapContext.getRegion({  
          success: (res) => {  
            console.log(res.southwest);  
            console.log(res.northeast);  
          }  
        })  
      },  
      updateMarker() {  
        this.markers = [{  
            id: 100,  
            latitude: 39.989631,  
            longitude: 116.481018,  
            title: '方恒国际 阜通东大街6号',  
            zIndex: '1',  
            rotate: 130,  
            width: 20,  
            height: 20,  
            anchor: {  
              x: 0.5,  
              y: 1  
            },  
            label: {  
              content: 'xxxxxxxxxxx'  
            },  
            callout: {  
              content: '方恒国际 阜通东大街6号',  
              color: '#00BFFF',  
              fontSize: 10,  
              borderRadius: 4,  
              borderWidth: 1,  
              borderColor: '#333300',  
              bgColor: '#CCFF99',  
              padding: '5',  
              display: 'ALWAYS'  
            }  
          },  
          {  
            id: 200,  
            latitude: 39.9086920000,  
            longitude: 116.3974770000,  
            title: '天安门',  
            zIndex: '1',  
            iconPath: '/static/logo.png',  
            width: 40,  
            height: 40,  
            anchor: {  
              x: 0.5,  
              y: 1  
            },  
            callout: {  
              content: '首都北京\n天安门',  
              color: '#00BFFF',  
              fontSize: 12,  
              borderRadius: 2,  
              borderWidth: 0,  
              borderColor: '#333300',  
              bgColor: '#CCFF11',  
              padding: '1',  
              display: 'ALWAYS'  
            }  
          }  
        ]  
      }  
    }  
  }  
</script>  

<style>  
  .map {  
    width: 750rpx;  
  }  
</style>  
  • 笑望哥 (作者)

    安卓版本9

    markers是云打包后图标好像丢失一样

    2020-04-03 19:53

笑望哥

笑望哥 (作者)

scale属性是我设置的字段类型问题,以前设置字符串是可以的,现在不可以。

h***@126.com

h***@126.com

请问楼主解决了吗?

该问题目前已经被锁定, 无法添加新回复