map.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view>
  3. <view class="page-body">
  4. <view class="page-section page-section-gap">
  5. <map style="width: 100%; height: 100vh;" :latitude="latitude" :longitude="longitude" :markers="covers">
  6. <cover-view class="cover-view">
  7. <cover-view class="container">
  8. <cover-view class="flex-wrp" style="flex-direction:row;">
  9. <cover-view class="flex-item demo-text-1">
  10. <cover-view style="font-weight: bold;">黑龙江中天昊元贸易有限公司</cover-view>
  11. <cover-view style="margin-top: 20rpx;color: #ccc;font-size: 26rpx;display: flex;align-items: center;"><image src="../../static/location.png" mode="widthFix" style="width: 20px;margin-right: 20rpx;"></image>辽宁省营口市皱鱼圈区青龙山大街8号</cover-view>
  12. </cover-view>
  13. </cover-view>
  14. </cover-view>
  15. </cover-view>
  16. </map>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. id:0, // 使用 marker点击事件 需要填写id
  26. title: 'map',
  27. latitude: 39.909,
  28. longitude: 116.39742,
  29. covers: []
  30. }
  31. },
  32. onLoad(options) {
  33. var location=options.location.split(',')
  34. this.latitude=location[0]
  35. this.longitude=location[1]
  36. this.covers = [
  37. {
  38. latitude: this.latitude,
  39. longitude: this.longitude,
  40. width:34,
  41. height:40,
  42. iconPath: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/marker.png'
  43. }
  44. ]
  45. },
  46. methods: {
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. .cover-view {
  52. position: absolute;
  53. bottom: 80rpx;
  54. left:20rpx;
  55. /* opacity: .7; */
  56. }
  57. .flex-wrp{
  58. display:flex;
  59. }
  60. .flex-item{
  61. width: calc(100vw - 40rpx);
  62. height: 140rpx;
  63. font-size: 26rpx;
  64. }
  65. .demo-text-1 {
  66. background: #fff;
  67. border-radius: 20rpx;
  68. padding: 20rpx 40rpx;
  69. box-sizing: border-box;
  70. }
  71. </style>