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.

34 lines
864 B

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