cm-navbar.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view class="navbar" v-if="modal.length > 0">
  3. <view class="navbar-item" v-for="(item, index) in navbarList" :key="index" @click.stop="$emit('click', item)">
  4. <image class="navbar-icon" :src="item.image" mode="widthFix"></image>
  5. <view class="navbar-label" v-text="item.name"></view>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. name: 'cm-navbar',
  12. props: {
  13. modal: {
  14. type: Array,
  15. default: []
  16. }
  17. },
  18. computed: {
  19. navbarList() {
  20. return this.modal.map(item => {
  21. item.id = item.bigTypeId
  22. item.image = item.crmIcon
  23. return item
  24. })
  25. }
  26. }
  27. }
  28. </script>
  29. <style lang="scss" scoped>
  30. .navbar {
  31. @extend .cm-flex-between;
  32. justify-content: flex-start;
  33. flex-wrap: wrap;
  34. padding: 40rpx 28rpx 12rpx;
  35. background: #fff;
  36. .navbar-item {
  37. @extend .cm-flex-center;
  38. flex-direction: column;
  39. width: 25%;
  40. padding-bottom: 28rpx;
  41. .navbar-icon {
  42. width: 110rpx;
  43. height: 110rpx;
  44. }
  45. .navbar-label {
  46. margin-top: 12rpx;
  47. font-size: 28rpx;
  48. color: #666;
  49. }
  50. }
  51. }
  52. </style>