在map组件里如何一键改变scale?
发布于 2 年前 作者 blai 2289 次浏览 来自 官方Issues

在使用map组件时,要实现用户手动缩放地图后,想一键调整到某个scale值(比如scale=3),这个要怎样实现?

btw,setdata scale没有反应。

2 回复

吧你代码贴出来,我试了一下可以的。

  <map id="myMapscale="{{mapScale}}"></map>

data:{ mapScale:14,

  setMapScale: function (e) {

    this.setData({

      mapScale:25,

    });

  },

  show_all(e){

    var t =this

    console.log('show_all')

    t.setData({scale:3})

  },

<map 

  id="map

  subkey="HPRBZ-36ZCU-5P5VW-BFVPM-7YX3V-HMBWT"

  layer-style="2"

  longitude="{{my_longitude}}" 

  latitude="{{my_latitude}}" 

  scale="{{scale}}" 

  markers="{{markers}}"      

  enable-poi="{{false}}"

  show-location 

  style="width: 100%; height: 60vh;">

</map>

  <cover-view bindtap="show_allclass="margin-left text-whitestyle="width: 20%;display:flex;flex-direction:row;justify-content:center;align-items:center;">

    <cover-view style="border: 1rpx white solid;border-radius: 20%;"> <cover-view style="margin: 5rpx;">全景</cover-view> </cover-view> 

  </cover-view>

回到顶部