home.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view>
  3. <tabs ref="tab" :currentTab="currentTabIndex" @changeIndex="changeTabIndex"></tabs>
  4. <movable-area class="movableArea">
  5. <movable-view class="movableView" direction="all" x="680rpx" y="700rpx"><image src="/static/image/map.png" mode="widthFix" @click="jumpMap"></image></movable-view>
  6. </movable-area>
  7. <scroll-view scroll-y="true">
  8. <Over v-if="currentTabIndex == 0" @changeOver="changeOverNum"></Over>
  9. <Info v-if="currentTabIndex == 1"></Info>
  10. <Pollution v-if="currentTabIndex == 2"></Pollution>
  11. <Clean v-if="currentTabIndex == 3"></Clean>
  12. </scroll-view>
  13. <tabbar :currentTab="0"></tabbar>
  14. </view>
  15. </template>
  16. <script>
  17. import tabbar from "@/components/tabbar";
  18. import tabs from "@/components/home-tabs/index.vue";
  19. import { log } from "@/utils/base.js";
  20. import Over from "./components/over.vue";
  21. //#ifdef H5
  22. //#endif
  23. import Info from "./components/info.vue";
  24. import Pollution from "./components/pollution.vue";
  25. import Clean from "./components/clean.vue";
  26. export default {
  27. components: {
  28. Over,
  29. //#ifdef H5
  30. //#endif
  31. Info,
  32. Pollution,
  33. Clean,
  34. tabs,
  35. tabbar,
  36. },
  37. data() {
  38. return {
  39. currentTabIndex: 0,
  40. };
  41. },
  42. onLoad() {},
  43. methods: {
  44. jumpMap() {
  45. uni.navigateTo({
  46. url: `/pages_map/map`,
  47. });
  48. },
  49. changeOverNum(num) {
  50. num = num || 0;
  51. this.$refs.tab.changeOverNum(num);
  52. },
  53. changeTabIndex(index) {
  54. index = index || 0;
  55. this.currentTabIndex = index;
  56. },
  57. },
  58. };
  59. </script>
  60. <style lang="scss">
  61. .movableArea {
  62. position: fixed;
  63. top: 0;
  64. left: 0;
  65. width: 100%;
  66. height: 100%;
  67. z-index: 10000;
  68. pointer-events: none; //设置area元素不可点击,则事件便会下移至页面下层元素
  69. .movableView {
  70. pointer-events: auto; //可以点击
  71. width: 120rpx;
  72. height: 120rpx;
  73. border-radius: 50%;
  74. image {
  75. width: 100%;
  76. height: 100%;
  77. }
  78. }
  79. }
  80. </style>