x-tabs.vue 926 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view class="card_tag">
  3. <view class="tab_item center_in" :class="current == item.type ? 'activate_tab' :''" v-for="(item,index) in list"
  4. :key="index" @click="getTab(item)">{{item.title}}</view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. props: {
  10. list: {
  11. type: Array,
  12. default: []
  13. },
  14. current: {
  15. type: [String, Number],
  16. default: ''
  17. }
  18. },
  19. data() {
  20. return {
  21. }
  22. },
  23. methods:{
  24. getTab(event){
  25. this.$emit('change',event)
  26. }
  27. }
  28. }
  29. </script>
  30. <style lang="scss">
  31. .card_tag {
  32. display: flex;
  33. width: fit-content;
  34. width: -webkit-fit-content;
  35. width: -moz-fit-content;
  36. border: 1rpx solid rgba(175, 148, 93, 1);
  37. border-radius: 40rpx;
  38. }
  39. .tab_item {
  40. font-size: 30rpx;
  41. min-width: 100rpx;
  42. height: 48rpx;
  43. color: rgba(177, 177, 177, 1);
  44. }
  45. .activate_tab {
  46. color: #fff;
  47. background-color: rgba(175, 148, 93, 1);
  48. border-radius: 40rpx;
  49. }
  50. </style>