main.vue 1.4 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. <Icon icon="ep:location" />
  35. {{ label }}
  36. </el-row>
  37. </el-col>
  38. </el-link>
  39. </div>
  40. </template>
  41. <script setup lang="ts" name="WxLocation">
  42. const props = defineProps({
  43. locationX: {
  44. required: true,
  45. type: Number
  46. },
  47. locationY: {
  48. required: true,
  49. type: Number
  50. },
  51. label: {
  52. // 地名
  53. required: true,
  54. type: String
  55. },
  56. qqMapKey: {
  57. // QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
  58. required: false,
  59. type: String,
  60. default: 'TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E' // 需要自定义
  61. }
  62. })
  63. defineExpose({
  64. locationX: props.locationX,
  65. locationY: props.locationY,
  66. label: props.label,
  67. qqMapKey: props.qqMapKey
  68. })
  69. </script>