x***@163.com
x***@163.com
  • 发布:2021-08-03 17:31
  • 更新:2022-05-27 17:13
  • 阅读:1355

微信小程序上 map 设置 scale 无效,求指点

分类:uni-app
map
    <view class="h100 w100">  
        <!-- <view class="h100 w100" v-if="Platform==='H5'" id="indexMap"> </view> -->  
        <map    
        id="indexMap"   
        ref='indexMap1'   
        @regionchange='changeEvent'   
        :show-location='showLocation'   
        style="width: 100%; height: 100%;"   
        :latitude="locationInfo.lat"   
        :longitude="locationInfo.lng"   
        :markers ='markers'  
        :scale="scale"  
        :min-scale='3'  
        :max-scale='18'  
        @callouttap='callouttap'  
        @updated ='mapUpdated'  
        >  
        </map>  
    </view>  

    uni.$on('moveStart',res=>{  
                console.log('map moveStart: ',res.name);  
                    console.log('this.mapContext: ', this.mapContext);  
                    this.scale = 18  
                    this.mapContext&&this.mapContext.moveToLocation({  
                        latitude:Number(res.lat),  
                        longitude:Number(res.lng),  
                        success:res=> {    

                            console.log('moveToLocation222',res)    
                        }  
                    })  

            })
2021-08-03 17:31 负责人:无 分享
已邀请:
7***@qq.com

7***@qq.com

这个问题我查了好久,终于搞定。你试试这样写 this.scale = this.scale == 11 ? 11.000001 : 11

  • 6***@qq.com

    亲测可以,感谢提供

    2023-02-09 18:42

x***@163.com

x***@163.com (作者) - 前端开发

vue cli 创建的项目

要回复问题请先登录注册