Я не уверен, что это CSS, который их расширяет, или это делает что-то связанное с vue
{{ title }}
{{ content }}
import { defineProps } from 'vue'
import chevronIcon from '/images/chevron.svg'
interface Props {
title: string
content: string
isOpen: boolean
accordionId: string | null
}
const props = defineProps()
const emit = defineEmits()
const toggle = () => {
emit('accordionClick', props.accordionId!)
}
.accordion {
border: 1px solid #e0e0e0;
border-radius: 5px;
margin-bottom: 1rem;
width: 100%;
max-width: 320px;
}
.accordion-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
cursor: pointer;
h3 {
font-size: 1.1rem;
font-weight: none;
}
}
.chevron {
display: inline-flex;
transition: transform 0.3s ease;
height: 30px;
}
.rotated {
transform: rotate(180deg);
}
.accordion-body {
padding: 1rem;
background-color: #ffffff;
border-top: 1px solid #e0e0e0;
color: #333;
font-size: 1rem;
overflow: hidden;
transition:
max-height 0.3s ease,
opacity 0.3s ease;
max-height: 500px;
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... s-on-click