map.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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;font-size: 28rpx;">{{dataObj.companyName}}</cover-view>
  11. <cover-view style="margin-top: 24rpx;color: rgba(128, 128, 128, 1);;font-size: 24rpx;display: flex;align-items: center;"><image src="https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/point.png" mode="widthFix" style="width: 20px;margin-right: 24rpx;"></image>{{dataObj.province}}{{dataObj.city}}{{dataObj.area}}{{dataObj.detailedAddress}}</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. dataObj:{
  31. companyName:'',
  32. area:'',
  33. city:'',
  34. province:'',
  35. detailedAddress:''
  36. }
  37. }
  38. },
  39. onLoad(options) {
  40. this.dataObj = JSON.parse(options.val)
  41. let location=this.dataObj.location.split(',')
  42. this.latitude=location[0]
  43. this.longitude=location[1]
  44. this.covers = [
  45. {
  46. latitude: this.latitude,
  47. longitude: this.longitude,
  48. width:34,
  49. height:40,
  50. iconPath: 'https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/marker.png'
  51. }
  52. ]
  53. },
  54. methods: {
  55. }
  56. }
  57. </script>
  58. <style lang="scss">
  59. .cover-view {
  60. position: absolute;
  61. bottom: 80rpx;
  62. left:20rpx;
  63. /* opacity: .7; */
  64. }
  65. .flex-wrp{
  66. display:flex;
  67. }
  68. .flex-item{
  69. width: calc(100vw - 40rpx);
  70. height: 150rpx;
  71. font-size: 26rpx;
  72. }
  73. .demo-text-1 {
  74. background: #fff;
  75. border-radius: 20rpx;
  76. padding: 24rpx;
  77. box-sizing: border-box;
  78. }
  79. </style>