Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

evaluate-tab-item.vue 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!-- 评价列表筛选 item -->
  2. <template>
  3. <view class="tabs">
  4. <view class="tab as-gravity-center" v-for="(tab,index) in tabs" :key="index"
  5. :class="curIndex === index ? 'active' : 'normal'" @click="tabClickHandle(tab,index)">
  6. {{tab}}
  7. </view>
  8. </view>
  9. </template>
  10. <script setup lang="ts">
  11. import { ref } from "vue";
  12. defineProps({
  13. tabs: {
  14. type: Array,
  15. default: () => {
  16. return [];
  17. }
  18. }
  19. })
  20. const curIndex = ref(0);
  21. const emit = defineEmits(['tabClick'])
  22. const tabClickHandle = (item, index) => {
  23. curIndex.value = index;
  24. emit('tabClick', item);
  25. }
  26. </script>
  27. <style lang="scss" scoped>
  28. .tabs {
  29. display: flex;
  30. flex-direction: row;
  31. flex-wrap: wrap;
  32. justify-content: space-between;
  33. // margin-right: -30rpx;
  34. // margin-top: -16rpx;
  35. padding: 30rpx;
  36. background-color: white;
  37. position: fixed;
  38. left: 0;
  39. top: 0;
  40. box-sizing: border-box;
  41. width: 100%;
  42. .tab {
  43. font-size: 24rpx;
  44. min-width: 135rpx;
  45. height: 52rpx;
  46. border-radius: 26rpx;
  47. margin-right: 30rpx;
  48. margin-top: 16rpx;
  49. }
  50. .normal {
  51. color: #333333;
  52. background-color: white;
  53. border: 1px solid #999999;
  54. }
  55. .active {
  56. color: white;
  57. background: #00B38B;
  58. }
  59. }
  60. </style>