nav-menu.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <view class="wrap-nav-menu" v-if="menus && menus.length > 0">
  3. <nav-bottom height="152rpx">
  4. <view class="menu-layout">
  5. <view class="item" v-for="(item, index) in menus" :key="index" @click="onclick(index, item)">
  6. <view style="width: 64rpx;height: 64rpx;display: flex;justify-content: center;align-items: center;">
  7. <u-icon :name="item.icon" imgMode="aspectFit" color="#F0516E" :size="isLocal(item.icon) ? '48rpx' : '64rpx'"></u-icon>
  8. </view>
  9. <view class="title">{{ item.title }}</view>
  10. </view>
  11. </view>
  12. </nav-bottom>
  13. </view>
  14. </template>
  15. <script>
  16. import NavBottom from '@/components/nav-bottom/index.vue'
  17. export default {
  18. components: {
  19. NavBottom
  20. },
  21. props: {
  22. menus: {
  23. type: Array,
  24. default: () => []
  25. }
  26. },
  27. methods: {
  28. onclick(index, value) {
  29. this.$emit('itemClick', index, value)
  30. },
  31. isLocal(value) {
  32. if(value) {
  33. return value.indexOf('/') > -1
  34. }
  35. return false
  36. }
  37. }
  38. }
  39. </script>
  40. <style lang="scss" scoped>
  41. .wrap-nav-menu {
  42. z-index: 998;
  43. border-top: 1rpx solid #F3F4F6;
  44. position: fixed;
  45. left: 0;
  46. bottom: env(safe-area-inset-bottom);
  47. width: 100%;
  48. padding: 0;
  49. margin: 0;
  50. .menu-layout {
  51. display: flex;
  52. align-items: center;
  53. justify-content: space-evenly;
  54. margin-top: 3.5%;
  55. .item {
  56. display: flex;
  57. flex-direction: column;
  58. align-items: center;
  59. .title {
  60. color: #F0516E;
  61. font-size: 28rpx;
  62. font-weight: 400;
  63. margin-top: 4rpx;
  64. }
  65. }
  66. }
  67. }
  68. </style>