distribution.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="container">
  3. <map 
  4. :latitude="latitude"
  5. :longitude="longitude"
  6. scale="11" 
  7. :markers="markers"
  8. :show-location="true"
  9. @markertap="markertap"
  10. @updated='mapUpdated'
  11. @tap='closeMapMarker'></map>
  12. </view>
  13. </template>
  14. <script>
  15. import amap from '@/js_sdk/js-amap/amap-wx.130.js'
  16. export default {
  17. data() {
  18. return {
  19. }
  20. },
  21. onShow() {
  22. },
  23. onLoad() {
  24. this.amapPlugin = new amap.AMapWX({
  25. key: this.mapKey  //该key 是在高德中申请的微信小程序key
  26. });
  27. this.amapPlugin.getRegeo({
  28. type: 'gcj02', //map 组件使用的经纬度是国测局坐标, type 为 gcj02
  29. success: function(res) {
  30. const latitude = res[0].latitude;
  31. const longitude = res[0].longitude;
  32. that.longitude = longitude;
  33. that.latitude = latitude;
  34. that.mapInfo=res[0];
  35. },
  36. fail: (res) => {
  37. console.log(JSON.stringify(res));
  38. }
  39. });
  40. },
  41. methods: {
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. </style>