<template>
<view class="map">
<map id="map" :latitude="latitude" :longitude="longitude" :markers="covers">
</map>
</view>
</template>
<script>
export default {
data() {
return {
title: 'map',
latitude: 28.204039,
longitude: 112.985415,
covers: []
}
},
onLoad() {
var map = uni.createMapContext('map');
map.getRegion({
success: function(res) {
console.log(JSON.stringify(res));
},
fail: (data, code) => {
console.log('fail' + JSON.stringify(data));
}
});
},
methods: {
//点击标记
makertap: function(e) {
console.log("1");
},
//点击气泡
callouttap: function(e) {
console.log("2");
},
//地图视野发生变化
regionchange: function(e) {
console.log("3");
}
},
components: {
}
}
</script>
<style>
.map {
width: 100%;
position: fixed;
top: 0;
bottom: 0;
text-align: center;
background: #FFFFFF;
}
map {
width: 100%;
height: 100%;
}
</style>
操作流程没错,我把代码放上来
错误代码是
11:56:52.773 [ERROR] : thirdScriptError
11:56:52.773 null is not an object (evaluating 'bounds.northease');at pages/list/map onShow function;at setTimeout callback function
11:56:52.773 getBounds@uniappservice.html:4199:34
11:56:52.773 f8@uniappservice.html:1:46232
11:56:52.773 N2@uniappservice.html:1:84364
11:56:52.773 m1L@uniappservice.html:1:86426
11:56:52.773 s1L@uniappservice.html:1:86906
11:56:52.773 q5b@uniappservice.html:1:220409
11:56:52.773 W7o@uniappservice.html:1:221750
11:56:52.773 value@uniappservice.html:1:358215
11:56:52.773 uniappservice.html:1:358529
11:56:52.773 uniappservice.html:1:249941
11:56:52.773 uniappservice.html:1:356458
11:56:52.773 uniappservice.html:1:220951
11:56:52.774 g1L@uniappservice.html:1:87391
11:56:52.774 C4@uniappservice.html:1:84217
11:56:52.774 uniappservice.html:1:273
11:56:52.774 uniappservice.html:1:193351
11:56:52.774 __uniappservice.html:1:398729