-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H5平台无法使用map.getRegion及getScale #5241
Comments
hello , 你这个 temp1 是如何产生的? 提供一下你的代码。 使用这个方法需要:uni.createMapContext("map", this); |
getRegion和getScale方法都是通过回调方式返回数据 uni.createMapContext('myMap').getRegion({
success: function (res) {
console.log('视野范围:', res);
},
fail: function (err) {
console.error('获取视野范围失败:', err);
}
}); |
hello,你是在哪个版本产生的问题?更新到最新版也会有吗? |
当前版本是:3.0.0 <template>
<map
id="unimap"
class="w-750 h-full"
:longitude="centerPoint.longitude"
:latitude="centerPoint.latitude"
:scale="mapScale"
@markertap="markertap"
@regionchange="regionchange"
></map>
</template>
<script setup>
import { onMounted } from 'vue';
onMounted(() => {
uni.createMapContext('unimap').getRegion({
success: function (res) {
console.log('视野范围:', res);
},
fail: function (err) {
console.error('获取视野范围失败:', err);
},
complete: () => {}
});
});
async function regionchange(event) {
console.log('范围变化', event);
if (event.type !== 'end') return;
uni.createMapContext('unimap').getRegion({
success: function (res) {
console.log('视野范围:', res);
},
fail: function (err) {
console.error('获取视野范围失败:', err);
},
complete: () => {}
});
}
</script> 在onMounted时,可以获取到视野范围,在regionchange事件响应方法中,getRegion方法无响应,并且未捕获到异常 |
感谢反馈,能够复现,之后会排查一下 |
如题,H5端无法使用mapContext来调用getRegion及getScale,两者的返回值都是undefined

The text was updated successfully, but these errors were encountered: