index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="preview_location_container">
  3. <custom-nav-bar title="位置" />
  4. <map
  5. class="map_area"
  6. :style="{ height: height }"
  7. :latitude="latng[0]"
  8. :longitude="latng[1]"
  9. :markers="marks"
  10. >
  11. </map>
  12. </view>
  13. </template>
  14. <script>
  15. import CustomNavBar from "../../../components/CustomNavBar/index.vue";
  16. export default {
  17. components: {
  18. CustomNavBar,
  19. },
  20. data() {
  21. return {
  22. latng: [],
  23. marks: [],
  24. height: "0px",
  25. };
  26. },
  27. onLoad(options) {
  28. const { latng } = options;
  29. this.latng = latng.split(",");
  30. this.getMarks();
  31. const { windowHeight, statusBarHeight } = uni.getWindowInfo();
  32. this.height = `${windowHeight - statusBarHeight - 44}px`;
  33. },
  34. methods: {
  35. getMarks() {
  36. this.marks = [
  37. {
  38. id: 123456,
  39. latitude: this.latng[0],
  40. longitude: this.latng[1],
  41. iconPath: "https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/location.png",
  42. },
  43. ];
  44. },
  45. },
  46. };
  47. </script>
  48. <style lang="scss">
  49. .preview_location_container {
  50. @include colBox(false);
  51. height: 100vh;
  52. .map_area {
  53. width: 100%;
  54. }
  55. }
  56. </style>