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.

43 lines
1.1 KiB

2 years ago
  1. <template>
  2. <div class="tw-flex tw-flex-wrap">
  3. <button v-for="(item, index) in times" :key="index" :class="[
  4. 'tw-transition tw-flex tw-justify-center tw-items-center tw-btn-md tw-border tw-border-solid tw-px-[16px] tw-py-[10px] tw-mr-[20px] tw-mb-[20px] tw-rounded-xl tw-border-secondary-default hover:tw-bg-secondary-default hover:tw-text-white',
  5. activeItem == index
  6. ? 'tw-bg-secondary-default tw-text-white'
  7. : ' tw-text-secondary-default tw-bg-white',
  8. ]" @click="change(index,item)">
  9. {{ item.start_time }} - {{ item.end_time }}
  10. </button>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. list: {
  17. type: Array,
  18. required: false,
  19. default: [],
  20. },
  21. },
  22. data() {
  23. return {
  24. selected: [],
  25. activeItem: null,
  26. };
  27. },
  28. computed: {
  29. times() {
  30. return this.list;
  31. },
  32. },
  33. methods: {
  34. change(index, item) {
  35. this.activeItem = index;
  36. this.$emit('selected', { start_time: item.start_time, end_time: item.end_time })
  37. }
  38. }
  39. };
  40. </script>
  41. <style lang="scss" scoped>
  42. </style>