h***@foxmail.com
h***@foxmail.com
  • 发布:2021-05-28 11:12
  • 更新:2021-05-28 11:12
  • 阅读:1102

【报Bug】vue/nvue map组件无法正确显示svg marker?

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Win10 18363.1500

HBuilderX类型: 正式

HBuilderX版本号: 3.1.13

手机系统: Android

手机系统版本号: Android 10

手机厂商: 华为

手机机型: Mate 30

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template>  
    <view class="content">  
        <map :latitude="latitude" :longitude="longitude" :markers="markers" style="height: 600px;width: 750rpx;"></map>  
    </view>  
</template>  

<script>  
    export default {  
    data() {  
        return {  
        latitude: 39.909,  
        longitude: 116.39742,  
            markers: [{  
              id: '1',  
              title: 'thumbup',  
              iconPath: '/static/iconfont-zan.svg',  
              latitude: 39.908,  
              longitude: 116.39742,  
              width: 40,  
              height: 40,  
              anchor: {  
                x: 0.5,  
                y: 0.5  
              }  
            }]  
    }  
      },  
   }  
</script>  

<style>  
.content {  
    flex-direction: column;  
    align-items: center;  
    justify-content: center;  
    flex: 1;  
    position: relative;  
  }  
  .map {  
    height: 800px;  
  }  
</style>  

操作步骤:

请运行附件demo

预期结果:

实际结果:

bug描述:

因为需要使用动态图片标记点,当前使用svg图片。
在APP端使用map组件,添加marker时,如果iconPath为svg图片,APP上会显示为默认的标记图片, H5端正常显示。

查看uni-app文档,在image文档下有这么一段描述 :

svg 格式的图片在不同的平台支持情况不同。具体为:app-nvue 不支持 svg 格式的图片,小程序上只支持网络地址。

请问:
vue/nvue的map组件是否可以使用svg marker?
如果不可以,是否有其它替代方案呢?

另,该问题是否可以通过引入高德SDK解决?
在高德地图工单询问该问题时,高德的回复:

uniapp 是否支持加载或集成高德的JS API获取移动端SDK?

其它已尝试方案:

  • 试用了社区的插件市场的 Amap+renderjs, 效果类似,无法正常显示。
  • iconPath填网络图片地址,效果同样
2021-05-28 11:12 负责人:无 分享
已邀请:

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