CommonCategoryDetailContentBlocks.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <template v-if="define.type === 'map'">
  3. <!-- 地理位置单元 -->
  4. <view class="d-flex flex-col mt-3 mb-2">
  5. <map id="map"
  6. class="w-100 height-350 mt-3"
  7. :latitude="content.latitude"
  8. :longitude="content.longitude"
  9. :markers="[
  10. {
  11. id: 1,
  12. latitude: content.latitude,
  13. longitude: content.longitude,
  14. iconPath: ImagesUrls.IconMarker,
  15. width: 40,
  16. height: 40,
  17. }
  18. ]"
  19. :scale="15"
  20. />
  21. <view class="d-flex flex-row justify-between bg-light radius-base p-2 mt-2">
  22. <view>
  23. <text class="iconfont icon-navigation"></text>
  24. <text class="address">{{ content.address }}</text>
  25. </view>
  26. <view class="d-flex flex-row align-center flex-shrink-0" @click="handleNavTo(content)">
  27. <text class="color-orange">去这里</text>
  28. <text class="iconfont icon-arrow-right"></text>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. </template>
  34. <script setup lang="ts">
  35. import { type PropType } from 'vue';
  36. import type { RenderTabDefine } from './CommonCategoryDetail.vue';
  37. import ImagesUrls from '@/common/config/ImagesUrls';
  38. defineProps({
  39. define: {
  40. type: Object as PropType<RenderTabDefine>,
  41. default: () => [],
  42. },
  43. content: {
  44. type: null,
  45. default: () => ({}),
  46. },
  47. })
  48. function handleNavTo(content: any) {
  49. if (!content?.latitude || !content?.longitude)
  50. return;
  51. uni.openLocation({
  52. latitude: Number(content.latitude),
  53. longitude: Number(content.longitude),
  54. })
  55. }
  56. </script>