index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view style="touch-action: none;">
  3. <view class="home" style="position:fixed;" :style="{ top: top + 'px'}" id="right-nav" @touchmove.stop.prevent="setTouchMove">
  4. <view class="homeCon bg-color-red" :class="homeActive === true ? 'on' : ''" v-if="homeActive">
  5. <navigator hover-class='none' url='/pages/index/index' open-type='switchTab'
  6. class='iconfont icon-shouye-xianxing' />
  7. <navigator hover-class='none' url='/pages/order_addcart/order_addcart' open-type='switchTab'
  8. class='iconfont icon-caigou-xianxing' />
  9. <navigator hover-class='none' url='/pages/user/index' open-type='switchTab'
  10. class='iconfont icon-yonghu1' />
  11. </view>
  12. <view @click="open" class="pictrueBox">
  13. <view class="pictrue">
  14. <image :src="homeActive === true ? '/static/images/close.gif' : '/static/images/open.gif'" class="image" />
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. mapGetters
  23. } from "vuex";
  24. export default {
  25. name: "Home",
  26. props: {},
  27. data: function() {
  28. return {
  29. top: "500"
  30. };
  31. },
  32. computed: mapGetters(["homeActive"]),
  33. methods: {
  34. setTouchMove(e) {
  35. if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
  36. this.top = e.touches[0].clientY
  37. }
  38. },
  39. open: function() {
  40. this.homeActive ?
  41. this.$store.commit("CLOSE_HOME") :
  42. this.$store.commit("OPEN_HOME");
  43. }
  44. }
  45. };
  46. </script>
  47. <style scoped>
  48. .pictrueBox {
  49. width: 130rpx;
  50. height: 120rpx;
  51. }
  52. /*返回主页按钮*/
  53. .home {
  54. position: fixed;
  55. color: white;
  56. text-align: center;
  57. z-index: 9999;
  58. right: 15rpx;
  59. display: flex;
  60. }
  61. .home .homeCon {
  62. border-radius: 50rpx;
  63. opacity: 0;
  64. height: 0;
  65. color: $theme-color;
  66. width: 0;
  67. }
  68. .home .homeCon.on {
  69. opacity: 1;
  70. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  71. width: 300rpx;
  72. height: 86rpx;
  73. margin-bottom: 20rpx;
  74. display: flex;
  75. justify-content: center;
  76. align-items: center;
  77. background: #f44939 !important;
  78. }
  79. .home .homeCon .iconfont {
  80. font-size: 48rpx;
  81. color: #fff;
  82. display: inline-block;
  83. margin: 0 auto;
  84. }
  85. .home .pictrue {
  86. width: 86rpx;
  87. height: 86rpx;
  88. border-radius: 50%;
  89. margin: 0 auto;
  90. }
  91. .home .pictrue .image {
  92. width: 100%;
  93. height: 100%;
  94. border-radius: 50%;
  95. transform: rotate(90deg);
  96. ms-transform: rotate(90deg);
  97. moz-transform: rotate(90deg);
  98. webkit-transform: rotate(90deg);
  99. o-transform: rotate(90deg);
  100. }
  101. </style>