index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <!-- #ifdef APP-PLUS -->
  3. <view class="animated dialog_nav" :style="{ top: (navH+65) + 'rpx', marginTop: sysHeight}"
  4. :class="[goodList?'dialogIndex':'',currentPage?'':'']" v-show="currentPage">
  5. <!-- #endif -->
  6. <!-- #ifndef APP-PLUS -->
  7. <view class="animated dialog_nav" :style="{ top: (navH+15) + 'rpx' }"
  8. :class="[goodList?'dialogIndex':'',goodsShow?'dialogGoods':'',currentPage?'':'']" v-show="currentPage">
  9. <!-- #endif -->
  10. <view class="dialog_nav_item" :class="item.after" v-for="(item,index) in selectNavList" :key="index"
  11. @click="linkPage(item.url)">
  12. <text class="iconfont" :class="item.icon"></text>
  13. <text class="pl-20">{{item.name}}</text>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. name: "homeIdex",
  20. props: {
  21. navH: {
  22. type: String | Number,
  23. default: ""
  24. },
  25. returnShow: {
  26. type: Boolean,
  27. default: true
  28. },
  29. goodList: {
  30. type: Boolean,
  31. default: false
  32. },
  33. currentPage: {
  34. type: Boolean,
  35. default: false
  36. },
  37. goodsShow: {
  38. type: Boolean,
  39. default: false
  40. },
  41. sysHeight: {
  42. type: String | Number,
  43. default: ""
  44. }
  45. },
  46. data: function() {
  47. return {
  48. selectNavList: [{
  49. name: this.$t(`首页`),
  50. icon: 'icon-shouye8',
  51. url: '/pages/index/index',
  52. after: 'dialog_after'
  53. },
  54. {
  55. name: this.$t(`搜索`),
  56. icon: 'icon-sousuo6',
  57. url: '/pages/goods/goods_list/index',
  58. after: 'dialog_after'
  59. },
  60. // {
  61. // name: this.$t(`购物车`),
  62. // icon: 'icon-gouwuche7',
  63. // url: '/pages/order_addcart/order_addcart',
  64. // after: 'dialog_after'
  65. // },
  66. // {
  67. // name: this.$t(`我的收藏`),
  68. // icon: 'icon-shoucang3',
  69. // url: '/pages/users/user_goods_collection/index',
  70. // after: 'dialog_after'
  71. // },
  72. {
  73. name: this.$t(`个人中心`),
  74. icon: 'icon-gerenzhongxin1',
  75. url: '/pages/user/index'
  76. },
  77. ]
  78. };
  79. },
  80. methods: {
  81. linkPage(url) {
  82. if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart', '/pages/user/index',
  83. '/pages/index/index'
  84. ]
  85. .indexOf(url) == -1) {
  86. uni.navigateTo({
  87. url: url
  88. })
  89. } else {
  90. uni.switchTab({
  91. url: url
  92. })
  93. }
  94. }
  95. },
  96. created() {},
  97. beforeDestroy() {}
  98. };
  99. </script>
  100. <style scoped lang="scss">
  101. .dialog_nav {
  102. position: absolute;
  103. /* #ifdef MP */
  104. left: 14rpx;
  105. /* #endif */
  106. /* #ifndef MP */
  107. right: 14rpx;
  108. /* #endif */
  109. width: 240rpx;
  110. background: #FFFFFF;
  111. box-shadow: 0px 0px 16rpx rgba(0, 0, 0, 0.08);
  112. z-index: 310;
  113. border-radius: 14rpx;
  114. &::before {
  115. content: "";
  116. width: 0;
  117. height: 0;
  118. border-left: 15rpx solid transparent;
  119. border-right: 15rpx solid transparent;
  120. border-bottom: 30rpx solid #fff;
  121. position: absolute;
  122. top: -20rpx;
  123. /* #ifdef APP-PLUS || H5 */
  124. right: 32rpx;
  125. /* #endif */
  126. /* #ifdef MP */
  127. left: 80rpx;
  128. /* #endif */
  129. border-bottom-color: #f2f2f2;
  130. }
  131. &::after {
  132. content: "";
  133. width: 0;
  134. height: 0;
  135. border-left: 15rpx solid transparent;
  136. border-right: 15rpx solid transparent;
  137. border-bottom: 30rpx solid #fff;
  138. position: absolute;
  139. top: -20rpx;
  140. /* #ifdef APP-PLUS || H5 */
  141. right: 32rpx;
  142. /* #endif */
  143. /* #ifdef MP */
  144. left: 80rpx;
  145. /* #endif */
  146. }
  147. &.dialogIndex {
  148. left: 14rpx;
  149. &::before {
  150. left: -160rpx !important;
  151. }
  152. }
  153. &.dialogGoods {
  154. &::before {
  155. left: -170rpx;
  156. }
  157. }
  158. }
  159. .dialog_nav_item {
  160. width: 100%;
  161. height: 84rpx;
  162. line-height: 84rpx;
  163. padding: 0 20rpx 0;
  164. box-sizing: border-box;
  165. border-bottom: #eee;
  166. font-size: 28rpx;
  167. color: #333;
  168. position: relative;
  169. display: flex;
  170. .iconfont {
  171. font-size: 32rpx;
  172. margin-right: 26rpx;
  173. }
  174. }
  175. .dialog_after {
  176. ::after {
  177. content: '';
  178. position: absolute;
  179. width: 90px;
  180. height: 1px;
  181. background-color: #EEEEEE;
  182. bottom: 0;
  183. right: 0;
  184. }
  185. }
  186. </style>