index.vue 2.5 KB

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