详细问题描述
(DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题)
map组件regionchange事件没有办法触发,参考了论坛里面的内容,还是没有办法触发,(真机调试,APP)
[内容]
重现步骤
[步骤]
渲染完成后拖动地图
[结果]
无法触发regionchange
[期望]
触发regionchange
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]
IDE运行环境说明
HBuilderX
[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]
[IDE版本号]
2.1.3.20190723
[windows版本号]
Windows 7
[mac版本号]
uni-app运行环境说明
Android真机
[运行端是h5或app或某个小程序?]
APP
[运行端版本号]
[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]
HBuilderX
[编译模式是老模板模式还是新的自定义组件模式?]
自定义组件模式
App运行环境说明
[Android版本号]
8.1
[iOS版本号]
[手机型号]
vivo y83a
[模拟器型号]
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段] <template> <view> <map id="map" :longitude="longitude" :latitude="latitude" :scale="scale" :controls="controls" @controltap="controltap" markers="markers" @markertap="markertap" @regionchange="regionchange" @end="regionchange" @begin="regionchange" show-location="true" style="{height: height +'px;'}" style="width: 100%;"> </map></view>
</template>
<script>
export default {
data() {
return {
latitude: '',
longitude: '',
scale: 13,
markers: [],
height: 1207,
items: [],
multiIndex: 0,
}
},
//每次都加载
onShow() {
var that = this;
uni.getSystemInfo({
success: (res) => {
that.controls[0].position.left = res.screenWidth - 65
that.controls[1].position.top = res.windowHeight - 153
that.controls[2].position.left = (res.screenWidth - 30) / 2
that.controls[2].position.top = res.windowHeight / 2 + 35
// that.setData({
that.height= res.windowHeight - 125
// });
}
})
},
onLoad() {
var that = this
uni.getLocation({
type: 'gcj02',
geocode: true,
success: function(res) {
// that.setData({
that.latitude=res.latitude
that.longitude= res.longitude
// })
},
})
},
methods: {
regionchange(e) {
uni.showToast({
title: 'regionchange',
duration: 8000
})
if (e.type == "end" && e.causedBy == "drag") {
var that = this
this.mapCtx = uni.createMapContext("map");
this.mapCtx.getCenterLocation({
type: 'gcj02',
success: function(res) {
console.log(res)
that.setData({
latitude: res.latitude,
longitude: res.longitude,
})
}
})
}
},
}
}
</script>
联系方式
[QQ]
1195339755
0 个回复