footTabs.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <view class="hover_content">
  3. <view class="hover_menu flex">
  4. <div class="sider" :class="isSider ? 'hoverd' : 'hover'"></div>
  5. <view
  6. class="menu_icon"
  7. v-for="(menu, i) in menus"
  8. :key="i"
  9. @tap="click(i, menu.pagePath)"
  10. >
  11. <view class="iconBox">
  12. <span class="iconfont" :class="[menu.icon, (selectedIndex == i)? 'hoverd' : 'hover']"></span>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <style scoped src="../../static/iconfont.css">
  19. </style>
  20. <style lang="scss" scoped>
  21. .hover_content {
  22. z-index: 999;
  23. width: 30%;
  24. padding: 1.5% 1%;
  25. border-radius: 100rpx;
  26. position: fixed;
  27. left: 50%;
  28. top: 90%;
  29. transform: translateX(-50%);
  30. box-shadow: rgba(100, 100, 111, 0.2) 0rpx 7rpx 29rpx 0rpx;
  31. background-color: #fff;
  32. .hover_menu {
  33. display: flex;
  34. justify-content: space-around;
  35. align-items: center;
  36. margin-top: 10rpx;
  37. .sider {
  38. position: absolute;
  39. width: 60rpx;
  40. height: 60rpx;
  41. border-radius: 50%;
  42. left: 14%;
  43. transition: all 0.1s;
  44. background: rgb(14, 92, 246);
  45. &.hover {
  46. left: 14%;
  47. background: rgb(14, 92, 246);
  48. }
  49. &.hoverd {
  50. left: 61%;
  51. background: rgb(14, 92, 246);
  52. }
  53. }
  54. .menu_icon {
  55. position: relative;
  56. .iconBox {
  57. width: 60rpx;
  58. height: 60rpx;
  59. border-radius: 50%;
  60. display: flex;
  61. justify-content: center;
  62. align-items: center;
  63. .iconfont {
  64. z-index: 999;
  65. color: #fff;
  66. font-size: 30rpx;
  67. font-family: "iconfont" !important;
  68. -webkit-font-smoothing: antialiased;
  69. -moz-osx-font-smoothing: grayscale;
  70. &.hover{
  71. color: rgb(187, 187, 187);
  72. }
  73. &.hoverd{
  74. color: #fff;
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }
  81. </style>
  82. <script>
  83. import app from '../../App'
  84. export default {
  85. data() {
  86. return {
  87. selectedIndex: app.globalData.selectedIndex,
  88. showselected: false,
  89. isSider: app.globalData.isSider,
  90. menus: [
  91. {
  92. pagePath: "pages/index/index",
  93. icon: "icon-zhuye",
  94. text: "首页",
  95. },
  96. {
  97. pagePath: "pages/selfCenter/index",
  98. icon: "icon-geren",
  99. text: "我的",
  100. },
  101. ],
  102. };
  103. },
  104. methods: {
  105. click(index, src) {
  106. this.selectedIndex = index
  107. app.globalData.selectedIndex = index
  108. if (index == 0) {
  109. this.isSider = false;
  110. app.globalData.isSider = false
  111. } else {
  112. this.isSider = true;
  113. app.globalData.isSider = true
  114. }
  115. uni.redirectTo({
  116. url: "/" + src,
  117. });
  118. },
  119. },
  120. };
  121. </script>