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.
50 lines
1.3 KiB
50 lines
1.3 KiB
<template>
|
|
<div class="faq">
|
|
<div class="faq__item" v-for="faq in faqs" :class="{'faq__item_opened': faq.opened}">
|
|
<div class="faq__item-head" @click="open(faq)">
|
|
<div class="faq__item-question">{{ faq.question }}</div>
|
|
<div class="faq__item-opener">
|
|
<svg class="icon" :class="{'icon-arrow-up': faq.opened, 'icon-arrow-down': !faq.opened}">
|
|
<use xlink:href="/static/img/sprite.svg#icon-arrow-down"></use>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div class="faq__item-answer" v-show="faq.opened" style="display: none;">{{ faq.answer }}</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'faq',
|
|
props: ['faqs'],
|
|
methods: {
|
|
open(faq){
|
|
faq.opened = ! faq.opened;
|
|
for(let f of this.faqs){
|
|
if(f !== faq){
|
|
f.opened = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="sass">
|
|
.faq
|
|
&__item-head
|
|
display: flex
|
|
background: #f8f8f8
|
|
padding: 7px 10px 5px
|
|
cursor: pointer
|
|
&__item-question
|
|
flex: 1
|
|
&__item-opener
|
|
margin-left: 10px
|
|
& .icon
|
|
width: 16px
|
|
height: 16px
|
|
&__item-answer
|
|
padding: 10px 10px
|
|
</style>
|
|
|