app-head-navigation.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="app-head-navigation dir-left-nowrap">
  3. <view class="app-item"
  4. v-for="(item, index) in list"
  5. :key="index"
  6. :class="{'app-active-item': activeIndex === item.id}"
  7. @click="active(item.id)"
  8. >{{item.name}}</view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'app-head-navigation',
  14. props: {
  15. list: {
  16. type: Array,
  17. default() {
  18. return [
  19. {
  20. name: '全部',
  21. id: 0,
  22. },
  23. {
  24. name: '待支付',
  25. id: 1
  26. },
  27. {
  28. name: '待使用',
  29. id: 2,
  30. },
  31. {
  32. name: '待评价',
  33. id: 4,
  34. }
  35. ,
  36. {
  37. name: '售后',
  38. id: 9,
  39. }
  40. ];
  41. }
  42. }
  43. },
  44. data() {
  45. return {
  46. activeIndex: 0
  47. }
  48. },
  49. methods: {
  50. active(index) {
  51. this.activeIndex = index;
  52. this.$emit('click', index);
  53. }
  54. }
  55. }
  56. </script>
  57. <style scoped lang="scss">
  58. .app-head-navigation {
  59. width: #{750rpx};
  60. height: #{80rpx};
  61. background-color: white;
  62. white-space: nowrap;
  63. border-bottom: #{1rpx} solid #e2e2e2;
  64. .app-item {
  65. display: inline-block;
  66. height: #{80rpx};
  67. line-height: #{80rpx};
  68. width: #{150rpx};
  69. border-bottom-width: #{4rpx};
  70. border-bottom-style: solid;
  71. border-bottom-color: transparent;
  72. color: #666666;
  73. font-size: #{32rpx};
  74. text-align: center;
  75. }
  76. .app-active-item {
  77. border-bottom-color: #ff5a5a;
  78. color: #ff5a5a;
  79. }
  80. }
  81. </style>