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.
|
|
<template> <div class="tw-flex tw-flex-wrap"> <button v-for="(item, index) in times" :key="index" :class="[ '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', activeItem == index ? 'tw-bg-secondary-default tw-text-white' : ' tw-text-secondary-default tw-bg-white', ]" @click="change(index,item)"> {{ item.start_time }} - {{ item.end_time }} </button> </div> </template> <script> export default { props: { list: { type: Array, required: false, default: [], }, }, data() { return { selected: [], activeItem: null, }; }, computed: { times() { return this.list; }, }, methods: { change(index, item) { this.activeItem = index; this.$emit('selected', { start_time: item.start_time, end_time: item.end_time }) } } }; </script> <style lang="scss" scoped>
</style>
|