index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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' class='iconfont icon-shouye-xianxing'></navigator>
  6. <navigator hover-class='none' url='/pages/order_addcart/order_addcart' open-type='switchTab' class='iconfont icon-caigou-xianxing'></navigator>
  7. <navigator hover-class='none' url='/pages/user/index' open-type='switchTab' 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 < 545 && e.touches[0].clientY > 66) {
  39. that.top = e.touches[0].clientY
  40. // that.setData({
  41. // top: e.touches[0].clientY
  42. // })
  43. }
  44. },
  45. open: function() {
  46. this.homeActive ?
  47. this.$store.commit("CLOSE_HOME") :
  48. this.$store.commit("OPEN_HOME");
  49. }
  50. },
  51. created() {
  52. }
  53. };
  54. </script>
  55. <style scoped>
  56. .pictrueBox {
  57. width: 130rpx;
  58. height: 120rpx;
  59. }
  60. /*返回主页按钮*/
  61. .home {
  62. position: fixed;
  63. color: white;
  64. text-align: center;
  65. z-index: 9999;
  66. right: 15rpx;
  67. display: flex;
  68. }
  69. .home .homeCon {
  70. border-radius: 50rpx;
  71. opacity: 0;
  72. height: 0;
  73. color: $theme-color;
  74. width: 0;
  75. }
  76. .home .homeCon.on {
  77. opacity: 1;
  78. animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
  79. width: 300rpx;
  80. height: 86rpx;
  81. margin-bottom: 20rpx;
  82. display: flex;
  83. justify-content: center;
  84. align-items: center;
  85. background: #f44939 !important;
  86. }
  87. .home .homeCon .iconfont {
  88. font-size: 48rpx;
  89. color: #fff;
  90. display: inline-block;
  91. margin: 0 auto;
  92. }
  93. .home .pictrue {
  94. width: 86rpx;
  95. height: 86rpx;
  96. border-radius: 50%;
  97. margin: 0 auto;
  98. }
  99. .home .pictrue .image {
  100. width: 100%;
  101. height: 100%;
  102. border-radius: 50%;
  103. transform: rotate(90deg);
  104. ms-transform: rotate(90deg);
  105. moz-transform: rotate(90deg);
  106. webkit-transform: rotate(90deg);
  107. o-transform: rotate(90deg);
  108. }
  109. </style>