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