美文网首页
小程序-地图(2)

小程序-地图(2)

作者: 最爱是荔枝 | 来源:发表于2018-05-31 23:28 被阅读35次

1circles在地图上显示圆
maps.wxml

   <map id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="14"   
    circles="{{circles}}" bindmarkertap="markertap" polyline="{{polyline}}" 
   bindregionchange="regionchange" show-location style="width: 100%; height: 
   300px;"></map>

maps.js
放在data中

  circles: [{
            latitude: res.latitude,
            longitude: res.longitude,
            color: '#FF0000DD',
            fillColor: '#7cb5ec88',
            radius: 3000,
            strokeWidth: 1
          }]
屏幕快照 2018-05-30 下午9.50.14.png

2 marker 上的气泡 callout
maps.js
color和bgColor要用6位都颜色值

markers: [{
            id: "1",
            latitude: res.latitude,
            longitude: res.longitude,
            width: 50,
            height: 50,
            iconPath: "../assests/imgs/location.png",
            title: "earch",
            callout:{
              content:'我是气泡',
              color:'#7cb5ec88',
              fontSize:12,
              borderRadius:10,
              bgColor:'#FF0000DD',
            }
          }],
屏幕快照 2018-05-30 下午10.05.29.png

3 polyline
指定一系列坐标点,从数组第一项连线至最后一项
maps.js

data: {
 
    polyline: [{
      points: [{
        longitude: 116.481451,
        latitude: 40.22077
      }, {
        longitude: 116.497847,
        latitude: 40.22077
      }, {
        longitude: 116.506507,
        latitude: 40.22077
      }],
      color: "#7cb5ec88",
      width: 13,
      dottedLine: false,
      arrowLine:true
    }]
  },

maps.wxml

<map id="map" longitude="{{longitude}}" latitude="{{latitude}}" scale="14" controls="{{controls}}" bindcontroltap="controltap" markers="{{markers}}" circles="{{circles}}" bindmarkertap="markertap" polyline="{{polyline}}" bindregionchange="regionchange" show-location style="width: 100%; height: 300px;"></map>

这个属性只能表示出直线型的


屏幕快照 2018-05-31 下午11.03.28.png

相关文章

  • 小程序-地图(2)

    1circles在地图上显示圆maps.wxml maps.js放在data中 2 marker 上的气泡 cal...

  • 小程序原生组件使用限制

    小程序当中多个原生组件显示问题 最近在开发小程序的过程中。使用到小程序地图组件,地图全页展示,在地图上展示其他组件...

  • Error: 代码包大小为 12051 kb,上限为 2048

    小程序大小限制是2m,整个小程序文件过大,最快的方法就是把本地图片改成网络图片,可以把本地图片上传到七牛

  • 微信小程序之百度地图API

    最近给我的小程序增加了天气预报的功能,采用的是Baidu地图的小程序API。 百度地图微信小程序JavaScrip...

  • 微信集成高德地图

    微信小程序之:小程序接入高德地图SDK - 简书

  • 小程序地图

    弄这个地图,找了很久,也怪自己没有好好看官网的例子,百度上一搜全是重复的帖子,转了又转,记录下自己遇到的坑吧。 有...

  • 小程序-地图

    小白教程[https://developers.weixin.qq.com/community/develop/a...

  • 微信小程序添加外部地图服务数据

    先上效果: 缘起 使用微信小程序做地图相关功能的时候,有个需求是需要接入自己发布的地图服务。查看微信小程序地图组件...

  • 2019-03-12文章精选

    1.基于lbs地图熟人社交应用---spot 一个地图社交软件,把玩下 2.“Linux”小程序 一个基于众包,来...

  • mpvue小程序加载不出图片 Failed to load lo

    mpvue开发小程序时候,要添加静态本地图片会报错: VM14878:2Failedtoloadlocalimag...

网友评论

      本文标题:小程序-地图(2)

      本文链接:https://www.haomeiwen.com/subject/kzaxsftx.html