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 list" :key="index" :class="[ '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', activeItem == index ? 'tw-bg-neutrals-700 tw-text-white' : 'tw-text-neutrals-700 tw-bg-white', ]" @click="active(index);"> {{ item.text }} </button> </div> </template> <script> export default { props: { list: { type: Array, }, }, data() { return { selected: [], activeItem: 0, }; }, methods: { active(idx) { this.activeItem = idx; this.$emit('choicesIdx', this.activeItem); } } }; </script> <style lang="scss" scoped>
</style>
|