index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="simple-map-nav">
  3. <van-popup v-model="show" :closeable="true" :position="position">
  4. <div class="title">地图导航</div>
  5. <div class="popup-content">
  6. <van-button
  7. class="btn"
  8. :size="size"
  9. :color="color"
  10. :round="round"
  11. @click="$emit('click', 'gaode')"
  12. >高德地图</van-button
  13. >
  14. <van-button
  15. class="btn"
  16. :size="size"
  17. :color="color"
  18. :round="round"
  19. @click="$emit('click', 'baidu')"
  20. >百度地图</van-button
  21. >
  22. <van-button
  23. class="btn"
  24. :size="size"
  25. :color="color"
  26. :round="round"
  27. @click="$emit('click', 'tx')"
  28. >腾讯地图</van-button
  29. >
  30. </div>
  31. </van-popup>
  32. </div>
  33. </template>
  34. <script>
  35. import { mapGetters } from 'vuex'
  36. export default {
  37. props: {
  38. color: {
  39. type: String,
  40. default: '#bc1724',
  41. },
  42. },
  43. computed: {
  44. ...mapGetters(['isPc']),
  45. position() {
  46. return this.isPc ? 'center' : 'bottom'
  47. },
  48. round() {
  49. return !this.isPc
  50. },
  51. size() {
  52. return this.isPc ? 'normal' : 'small'
  53. },
  54. },
  55. data() {
  56. return {
  57. show: false,
  58. }
  59. },
  60. methods: {
  61. close() {
  62. this.show = false
  63. },
  64. open() {
  65. this.show = true
  66. },
  67. },
  68. }
  69. </script>
  70. <style scoped lang="scss">
  71. @media screen and (min-width: 768px) {
  72. .simple-map-nav {
  73. .title {
  74. font-size: 18px;
  75. color: #666;
  76. text-align: center;
  77. padding: 24px 0;
  78. }
  79. .popup-content {
  80. display: flex;
  81. justify-content: space-between;
  82. align-items: center;
  83. width: 360px;
  84. padding: 0 24px 24px;
  85. }
  86. }
  87. }
  88. @media screen and (max-width: 768px) {
  89. .simple-map-nav {
  90. .title {
  91. font-size: 3.6vw;
  92. color: #666;
  93. text-align: center;
  94. padding: 2.4vw 0;
  95. }
  96. .popup-content {
  97. display: flex;
  98. align-items: center;
  99. flex-direction: column;
  100. padding: 2.4vw;
  101. ::v-deep {
  102. .van-button {
  103. width: 100%;
  104. margin: 1.2vw 0;
  105. }
  106. }
  107. }
  108. }
  109. }
  110. </style>