You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

evaluate-tab-item.vue 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. .tab{
  36. font-size: 24rpx;
  37. min-width: 135rpx;
  38. height: 52rpx;
  39. border-radius: 26rpx;
  40. margin-right: 30rpx;
  41. margin-top: 16rpx;
  42. }
  43. .normal{
  44. color: #333333;
  45. background-color: white;
  46. border: 1px solid #999999;
  47. }
  48. .active{
  49. color: white;
  50. background: #00B38B;
  51. }
  52. }
  53. </style>