index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <!-- 顶部下拉导航 -->
  3. <!-- #ifdef APP-PLUS -->
  4. <view class="animated dialog_nav" :style="{ top: (navH+15) + 'rpx', marginTop: sysHeight}" :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. &::before{
  115. left: -160rpx!important;
  116. }
  117. }
  118. &.dialogGoods{
  119. &::before{
  120. left: -170rpx;
  121. }
  122. }
  123. }
  124. .dialog_nav_item{
  125. width: 100%;
  126. height: 84rpx;
  127. line-height: 84rpx;
  128. padding: 0 20rpx 0;
  129. box-sizing: border-box;
  130. border-bottom: #eee;
  131. font-size: 28rpx;
  132. color: #333;
  133. position: relative;
  134. display: flex;
  135. .iconfont{
  136. font-size: 32rpx;
  137. margin-right: 26rpx;
  138. }
  139. }
  140. .dialog_after{
  141. ::after{
  142. content: '';
  143. position: absolute;
  144. width:90px;
  145. height: 1px;
  146. background-color: #EEEEEE;
  147. bottom: 0;
  148. right: 0;
  149. }
  150. }
  151. </style>