register_map.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view>
  3. <view class="page-body">
  4. <view class="page-section page-section-gap">
  5. <map style="width: 100%;height: 100vh;" :markers="markers" :longitude="longitude" :latitude="latitude" :circles="circles">
  6. </map>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. circles: [], //圆
  16. markers: [], //标记点
  17. latitude: 39.9,
  18. longitude: 116.4,
  19. };
  20. },
  21. onLoad() {
  22. const _this = this;
  23. uni.getSystemInfo({
  24. success: (res) => {
  25. _this.mapHeight = res.screenHeight - res.statusBarHeight
  26. _this.mapHeight = _this.mapHeight
  27. }
  28. })
  29. },
  30. created() {
  31. var that = this
  32. uni.getLocation({
  33. type: 'wgs84',
  34. success(res) {
  35. console.log(res, "当前位置");
  36. that.latitude = res.latitude
  37. that.longitude = res.longitude
  38. //标记点
  39. that.markers = [{
  40. id: 1,
  41. latitude: res.latitude,
  42. longitude: res.longitude,
  43. iconPath: '/static/sailun/map-pin.png',
  44. }]
  45. }
  46. });
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. </style>