哈哈哈888
哈哈哈888
  • 发布:2022-09-02 10:23
  • 更新:2022-09-02 10:23
  • 阅读:237

app使用地图电话在manifest.json也设置了,弹两次获取位置信息弹框

分类:uni-app

<template>
<view class="position-relative " :style="'height:'+height+'px'">
<map class="col-12" id="map" :markers="markers" :longitude="longitude" :latitude="latitude" :scale="14" show-location show-compass :style="'height:'+height+'px'"></map>

</view>  

</template>

<script>

export default {  

    data() {  
        return {  
            longitude:"",  
            latitude:"",  
            height: 100, //页面高度  

        }  
    },  
    methods: {  

    },  
    onLoad(){  
        let that=this  
        uni.getLocation({  
            type: 'wgs84',  
            success: (res) => {  
                that.longitude = res.longitude  
                that.latitude = res.latitude  
                uni.createMapContext('map').moveToLocation({  
                    longitude: res.longitude,  
                    latitude: res.latitude  
                })  
            },  
        });  
    }  

}  

</script>
<style></style>

2022-09-02 10:23 负责人:无 分享
已邀请:

要回复问题请先登录注册