map.vue 2.0 KB

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