4***@qq.com
4***@qq.com
  • 发布:2020-07-17 18:33
  • 更新:2020-08-07 11:51
  • 阅读:1733

【报Bug】官方API "位置" uni.createMapContext(mapId,this) 中 方法 moveToLocation 在nvue中无法 定位平移 到指定经纬度的位置

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 2.7.14

手机系统: iOS

手机系统版本号: iOS 13.4

手机厂商: 苹果

手机机型: iPhone8

页面类型: nvue

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:
<template>  
	<view>  
		<map id="test_map" style="width: 750rpx; height: 300px;" :show-location="true"   
			:longitude="map.longitude" :latitude="map.latitude">  
		</map>  
		<button @click="dingwei">定位到"北京西站"</button>  
	</view>  
</template>  
  
<script>  
export default {  
	data() {  
		return {  
			map: {  
				longitude: '',//经度  
				latitude: '',//纬度  
			}  
		}  
	},  
	onLoad() {  
		let _this = this;  
		uni.getLocation({  
		    type: 'gcj02',  
		    success: function (res) {  
				_this.map.longitude = res.longitude;  
				_this.map.latitude = res.latitude;  
		    }  
		});  
	},  
	methods: {  
		dingwei(){  
			//官方API uni.createMapContext(mapId,this)  
			//其中API对应方法之一: moveToLocation(OBJECT) //将地图中心移动到当前定位点,需要配合map组件的show-location使用  
			  
			//需要实现的目标:定位平移 到指定坐标位置.比如案例中定位到"北京西站"  
			//实际结果: 在iPhone8中,定位平移 到本人真实的当前位置  
			  
			uni.createMapContext('test_map', this).moveToLocation({  
				//该固定坐标为高德地图拾取,位置:北京西站  
				latitude: 39.894589,  
				longitude: 116.32125,  
				success: function(res){  
					console.log("此处无回调!!!本条信息未在控制台打印");  
					console.log(res);  
				}  
			});  
		}  
	}  
}  
</script>  
  
<style scoped>  
</style>  

预期结果:

调用 uni.createMapContext(mapId,this).moveToLocation(object) 时 界面定位平移到指定的经纬度位置

实际结果:

调用 uni.createMapContext(mapId,this).moveToLocation(object) 时 界面定位平移到本地真实定位位置

bug描述:

官方API "位置" uni.createMapContext(mapId,this) 中 方法 moveToLocation 在nvue中无法 定位平移 到指定经纬度的位置
其中在 vue里面 moveToLocation 方法正常可以 定位平移 到指定的经纬度位置

"moveToLocation 在 vue 里面功能正常"
"moveToLocation 在 vue 里面功能正常"
"moveToLocation 在 vue 里面功能正常"

"moveToLocation 在 nvue 里面功能异常,无法指定 经纬度 两个参数"
"moveToLocation 在 nvue 里面功能异常,无法指定 经纬度 两个参数"
"moveToLocation 在 nvue 里面功能异常,无法指定 经纬度 两个参数"

2020-07-17 18:33 负责人:DCloud_uniAD_HDX 分享
已邀请:
4***@qq.com

4***@qq.com (作者)

地图就卡在这里了,麻烦管理员能够尽快发现,能够争取在下一个版本中修改功能!

测试文件在附件里面,直接下载运行就行!
vue 和 nvue 代码一样,但是运行结果有明显区别!

非常紧急!!!
非常紧急!!!
非常紧急!!!

4***@qq.com

4***@qq.com (作者)

请官方回复!!!

4***@qq.com

4***@qq.com (作者)

请官方回复!!!

jxtian

jxtian

.vue页面有这个问题吗?

  • 4***@qq.com (作者)

    .vue没有这个问题, .vue和.nvue 两种我都试了,同一套测试代码, .vue正常, .nvue不正常!


    2020-07-20 10:35

jxtian

jxtian

你发过一个贴了吧,在处理中,不要捉急,https://ask.dcloud.net.cn/question/101673

  • 4***@qq.com (作者)

    尽快处理,希望下个版本能够修复,谢谢!


    2020-07-20 11:41

DCloud_uniAD_HDX

DCloud_uniAD_HDX

下版修复nvue问题,当前版本可以通过修改 map 组件经纬度属性解决

  • 4***@qq.com (作者)

    直接修改经纬度,没有 平移动画 ,而且只能修改一次有效!


    2020-07-20 15:34

  • 4***@qq.com (作者)

    HBX都更新两次了,为什么还没有修复我提的这个问题?而且还没有报bug?


    2020-07-29 10:17

DCloud_uniAD_HDX

DCloud_uniAD_HDX

HBuilderX 2.8.2+ 已修复

  • 4***@qq.com (作者)

    2.8.2.20200726 修复相关如下:



    • App-iOS平台 修复 nvue map 组件 moveToLocation 方法不触发回调的Bug 详情


    在这个版本说明中只修复了 moveToLocation 方法不触发回调的Bug , 没有修复 平移到指定经纬度的bug,现在我iPhone8 上仍旧是平移到当前位置,我需要的是平移到我指定的经纬度的位置!现在我的HBX版本为2.8.3+ 需要卸载HBX重新安装HBX? 手机上已经卸载重装了HBX基座!


    2020-08-04 11:42

  • DCloud_uniAD_HDX

    回复 4***@qq.com: 2个问题都修复了


    2020-08-07 11:49

DCloud_uniAD_HDX

DCloud_uniAD_HDX

<template>  
  <view>  
    <map id="test_map" ref="map1" style="width: 750rpx; height: 300px;" :show-location="true" :longitude="map.longitude"  
      :latitude="map.latitude">  
    </map>  
    <button @click="dingwei">定位到"北京西站"</button>  
    <button @click="dingwei2">ref 定位到"北京西站"</button>  
  </view>  
</template>  
  
<script>  
  export default {  
    data() {  
      return {  
        map: {  
          longitude: '', //经度  
          latitude: '', //纬度  
        }  
      }  
    },  
    onLoad() {  
      let _this = this;  
      uni.getLocation({  
        type: 'gcj02',  
        success: function(res) {  
          _this.map.longitude = res.longitude;  
          _this.map.latitude = res.latitude;  
        }  
      });  
    },  
    onReady() {  
      this.mapContext = uni.createMapContext('test_map', this);  
    },  
    methods: {  
      dingwei() {  
        //官方API uni.createMapContext(mapId,this)    
        //其中API对应方法之一: moveToLocation(OBJECT) //将地图中心移动到当前定位点,需要配合map组件的show-location使用    
  
        //需要实现的目标:定位平移 到指定坐标位置.比如案例中定位到"北京西站"    
        //实际结果: 在iPhone8中,定位平移 到本人真实的当前位置    
  
        this.mapContext.moveToLocation({  
          //该固定坐标为高德地图拾取,位置:北京西站    
          latitude: 39.894589,  
          longitude: 116.32125,  
          success: function(res) {  
            console.log("此处无回调!!!本条信息未在控制台打印");  
            console.log(res);  
          }  
        });  
      },  
      dingwei2() {  
        this.$refs.map1.moveToLocation({  
            //该固定坐标为高德地图拾取,位置:北京西站    
            latitude: 39.894589,  
            longitude: 116.32125  
          },  
          function(res) {  
            console.log("此处无回调!!!本条信息未在控制台打印");  
            console.log(res);  
          }  
        );  
      }  
    }  
  }  
</script>  
  
<style>  
</style>  

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