main.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <!--
  2. 【微信消息 - 定位】
  3. -->
  4. <template>
  5. <div>
  6. <el-link
  7. type="primary"
  8. target="_blank"
  9. :href="
  10. 'https://map.qq.com/?type=marker&isopeninfowin=1&markertype=1&pointx=' +
  11. locationY +
  12. '&pointy=' +
  13. locationX +
  14. '&name=' +
  15. label +
  16. '&ref=yudao'
  17. "
  18. >
  19. <el-col>
  20. <el-row>
  21. <img
  22. :src="
  23. 'https://apis.map.qq.com/ws/staticmap/v2/?zoom=10&markers=color:blue|label:A|' +
  24. locationX +
  25. ',' +
  26. locationY +
  27. '&key=' +
  28. qqMapKey +
  29. '&size=250*180'
  30. "
  31. />
  32. </el-row>
  33. <el-row>
  34. <el-icon><Location /></el-icon>
  35. <Icon icon="ep:location" />
  36. {{ label }}
  37. </el-row>
  38. </el-col>
  39. </el-link>
  40. </div>
  41. </template>
  42. <script setup lang="ts" name="WxLocation">
  43. const props = defineProps({
  44. locationX: {
  45. required: true,
  46. type: Number
  47. },
  48. locationY: {
  49. required: true,
  50. type: Number
  51. },
  52. label: {
  53. // 地名
  54. required: true,
  55. type: String
  56. },
  57. qqMapKey: {
  58. // QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
  59. required: false,
  60. type: String,
  61. default: 'TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E' // 需要自定义
  62. }
  63. })
  64. defineExpose({
  65. locationX: props.locationX,
  66. locationY: props.locationY,
  67. label: props.label,
  68. qqMapKey: props.qqMapKey
  69. })
  70. </script>