mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-19 00:45:54 +08:00
commit message
This commit is contained in:
66
pages/mine/address/map.vue
Normal file
66
pages/mine/address/map.vue
Normal file
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
|
||||
|
||||
|
||||
<!-- 自定义地图组件 -->
|
||||
<map
|
||||
class="map"
|
||||
:latitude="latitude"
|
||||
:longitude="longitude"
|
||||
scale="18"
|
||||
:markers="markers"
|
||||
:show-location="true"
|
||||
@markertap="markertap"
|
||||
@updated="mapUpdated"
|
||||
@tap="closeMapMarker"
|
||||
></map>
|
||||
</template>
|
||||
<script>
|
||||
import amap from "@/js_sdk/amap-wx.130.js";
|
||||
export default {
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
mounted() {
|
||||
this.initMap();
|
||||
},
|
||||
methods: {
|
||||
markertap() {},
|
||||
mapUpdated() {},
|
||||
closeMapMarker() {},
|
||||
|
||||
// 初始化地图
|
||||
initMap() {
|
||||
this.amapPlugin = new amap.AMapWX({
|
||||
key: "c03fe63e4ed7cfc6612304b3f46c19b5", //该key 是在高德中申请的微信小程序key
|
||||
});
|
||||
|
||||
this.amapPlugin.getRegeo({
|
||||
type: "gcj02", //map 组件使用的经纬度是国测局坐标, type 为 gcj02
|
||||
|
||||
success: function (res) {
|
||||
const latitude = res[0].latitude;
|
||||
|
||||
const longitude = res[0].longitude;
|
||||
|
||||
that.longitude = longitude;
|
||||
|
||||
that.latitude = latitude;
|
||||
|
||||
that.mapInfo = res[0];
|
||||
},
|
||||
|
||||
fail: (res) => {
|
||||
console.log(JSON.stringify(res));
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user