<script setup lang="ts">
import { ref } from "vue";
// 使用接口定义
const faqList = ref([
	{
		id: 1,
		title: 'What are the minimum, recommended system requirements?',
		content: 'As AiDA is a cloud-based system, only stable internet access is required.',
	},
	{
		id: 2,
		title: 'Does AiDA run on both a PC & a MAC?',
		content: 'Yes, AiDA supports both PC & MAC.',
	},
	{
		id: 3,
		title: 'Does AiDA run on an iPad?',
		content: 'Yes, AiDA can be run on an iPad.',
	},
	{
		id: 4,
		title: 'What File Types it supports?',
		content: 'The image file types that can be uploaded into AiDA: jpeg, jpg, png',
	},
	{
		id: 5,
		title: 'In what languages is AiDA system available',
		content: 'Currently, AiDA is available in English',
	},
	{
		id: 6,
		title: 'Can I receive my invoice?',
		content: 'The invoice will be sent to your registered mailbox 1 months before (for paid subscription) with the reminder email.',
	},
	{
		id: 7,
		title: 'How do I change my password?',
		content: 'You could change your password after login to your account in “My Account” page “Account details” part.',
	},
])
const openIdList = ref([])
const openInfo = (id) => {
	if(openIdList.value.includes(id)){
		openIdList.value = openIdList.value.filter(item => item !== id)
	}else{
		openIdList.value.push(id)
	}
}
defineExpose({})
</script>
<template>
	<section class="faq">
		<div class="content">
			<h2>FAQ</h2>
			<div class="faq-list">
				<div v-for="item in faqList" :key="item.id" class="faq-item">
					<h2 @click="openInfo(item.id)">
						{{ item.title }}
						<span class="iconfont icon-sanjiao_xia" :class="{'active': openIdList.includes(item.id)}"></span>
					</h2>
					<div class="info" :class="{'active': openIdList.includes(item.id)}">
						<p>{{ item.content }}</p>
					</div>
				</div>
			</div>
		</div>
	</section>
</template>
<style lang="less" scoped>
	.faq{
		width: 100%;
		padding: 60px 0;
		background-color: #f9f9f9;
		
		> .content{
			max-width: 1140px;
			margin: 0 auto;
			> h2{
				
				font-family: "Poppins", Sans-serif;
				font-size: 40px;
				font-weight: 600;
				letter-spacing: 1px;
				color: #000000;
				margin-bottom: 40px;
				line-height: 1;
				text-align: center;
			}
			
			> .faq-list{
				> .faq-item{
					border-bottom: 1px solid #d5d8dc;
					> h2{
						padding: 40px 0px 40px 0px;
						font-family: "Poppins", Sans-serif;
						font-size: 24px;
						line-height: 1.5em;
						color: #333333;
						font-weight: 700;
						display: flex;
						align-items: flex-start;
						justify-content: space-between;
						cursor: pointer;
						> span{
							font-size: 14px;
							transition: all .3s;
							&.active{
								transform: rotate(180deg);
							}
						}
					}
					> .info{
						height: 0;
						overflow: hidden;
						transition: all .3s;
						&.active{
							height: 70px;
						}
						> p{
							padding: 15px;
							color: #333333;
							font-weight: 400;
							font-size: 14px;
							line-height: 20px;
							margin-bottom: 20px;
						}
					}
				}
			}
		}
	}
</style>
