mobile.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div class="home">
  3. <div class="map">
  4. <maps ref="mapsRef"/>
  5. </div>
  6. <vaside class="vaside" @changeMap='changeMap'/>
  7. </div>
  8. </template>
  9. <script setup>
  10. import vaside from "./maside.vue";
  11. import maps from "@/components/maps";
  12. import emitter from "@/mitt/index";
  13. import { ref, defineEmits, onMounted, watch, nextTick } from "vue";
  14. import { Loading } from "@/components/UI";
  15. import { useRouter, useRoute } from "vue-router";
  16. // 得到子组件的切换列表信息
  17. const mapsRef =ref(null);
  18. const changeMap =(id)=>{
  19. // 把id传给子组件地图
  20. console.log(mapsRef.value);
  21. mapsRef.value.changeMap(id)
  22. // console.log('------------',id);
  23. }
  24. const router = useRouter();
  25. const currentCity = ref('')
  26. emitter.on("handleHover", (data) => {
  27. currentCity.value = data
  28. });
  29. emitter.on("handleClick", (data) => {
  30. if (data.num == "&nbsp;0") {
  31. return
  32. }
  33. router.push({ name: 'homelist', params: { id: data.rowid } })
  34. });
  35. onMounted(() => {
  36. Loading.hide()
  37. });
  38. </script>
  39. <style lang="scss" scoped>
  40. .home {
  41. width: 100%;
  42. background-image: url("~@/assets/images/resource/home_bg.jpg");
  43. background-size: cover;
  44. background-position: center;
  45. position: relative;
  46. z-index: 10;
  47. display: flex;
  48. justify-content: center;
  49. align-items: center;
  50. position: relative;
  51. .map {
  52. width: 100%;
  53. height: 100%;
  54. >div {
  55. width: 100%;
  56. height: 100%;
  57. }
  58. }
  59. .cityname {
  60. position: absolute;
  61. right: calc(6% + 340px);
  62. bottom: 10%;
  63. font-size: 20px;
  64. text-align: right;
  65. >p {
  66. &:first-of-type {
  67. font-size: 64px;
  68. font-weight: bold;
  69. color: transparent;
  70. line-height: 94px;
  71. -webkit-text-stroke: 2px var(--main-color);
  72. text-stroke: 2px var(--main-color);
  73. }
  74. &:last-of-type {
  75. font-size: 92px;
  76. font-weight: bold;
  77. color: var(--main-color);
  78. }
  79. }
  80. }
  81. .vaside {
  82. position: absolute;
  83. top: 50%;
  84. transform: translateY(-50%);
  85. left: 0;
  86. right: 0;
  87. }
  88. }
  89. @media screen and (max-width: 1000px) {}
  90. </style>