app-nav.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="app-nav dir-left-nowrap cross-center main-around">
  3. <view class="box-grow-1" v-for="(item, index) in list" :key="index" @click="active(item.id)">
  4. <text :style="{'color': activeIndex === item.id ? theme.color : '#353535'}" :class="activeIndex === item.id ? 'active': 'no-active'" >{{item.name}}</text>
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. name: 'app-nav',
  11. props: {
  12. theme: Object
  13. },
  14. data() {
  15. return {
  16. list: [
  17. {
  18. name: '全部',
  19. id: 0,
  20. },
  21. {
  22. name: '待付款',
  23. id: 1,
  24. },
  25. {
  26. name: '拼团中',
  27. id: 2,
  28. },
  29. {
  30. name: '拼团成功',
  31. id: 3,
  32. },
  33. {
  34. name: '拼团失败',
  35. id: 4,
  36. },
  37. ],
  38. activeIndex: 0
  39. }
  40. },
  41. methods: {
  42. active(id) {
  43. this.activeIndex = id;
  44. this.$emit('click', id);
  45. }
  46. }
  47. }
  48. </script>
  49. <style scoped lang="scss">
  50. .app-nav {
  51. width: #{750rpx};
  52. height: #{80rpx};
  53. font-size: #{26rpx};
  54. color: #666666;
  55. position: fixed;
  56. top: 0;
  57. left: 0;
  58. z-index: 1000;
  59. background-color: white;
  60. >view {
  61. text-align: center;
  62. }
  63. text {
  64. display: inline-block;
  65. height: #{80rpx};
  66. line-height: #{76rpx};
  67. }
  68. }
  69. .active {
  70. border-bottom: #{4rpx} solid;
  71. }
  72. .no-active {
  73. border-bottom: #{4rpx} solid #FFFFFF;
  74. }
  75. </style>