index.vue 3.6 KB

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