<template>
  <div class="qa-box">
    <div
      class="qa-item"
      v-for="(item, key) in questionList"
      :key="key">
      <div class="qa-block question clearfix">
        <div class="icon fl">问</div>
        <div class="content">
          <div>{{item.question}}</div>
        </div>
        <!-- <img
          class="icon"
          v-if="item.answer.length > 50"
          :class="{'active': item.isShow}"
          @click="switchShow(key)"
          src="../../static/images/icon_7.png"/> -->
      </div>
      <div class="qa-block clearfix">
        <div class="icon fl">答</div>
        <div class="content">
          <div>{{item.answer}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['questionList'],
  data () {
    return {
    }
  },
  methods: {
    // 切换展开
    switchShow (key) {
      this.questionList[key].isShow = !this.questionList[key].isShow
    }
  }
}
</script>

<style scoped lang="less">
@import '~@/assets/less/common.less';
.qa-box{
  margin: 0 @spacing 0;
  .qa-item{
    margin-bottom: @spacing;
    box-shadow:0px 2px 7px 0px rgba(0,0,0,0.1);
    border-radius: 5px;
    overflow: hidden;
    .qa-block{
      padding: 10px;
      &.question{
        font-size: 12px;
        background: #FFF2F5;
        color: #666666;
      }
      .icon{
        margin-right: 10px;
        width: 25px;
        height: 25px;
        line-height: 25px;
        border: solid 1px @themeColor;
        border-radius: 50%;
        font-size: 14px;
        text-align: center;
        color: @themeColor;
      }
      .content{
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 25px;
        overflow: hidden;
      }
    }

    .qa-head{
      position: relative;
      padding: 10px;
      background: #306cc5;
      color: #fff;
      /* .icon{
        position: absolute;
        top: 5px;
        right: 0;
        width: 30px;
        height: 30px;
        float: right;
        &.active{
          transform-origin: center center;
          transform: rotate(180deg);
        }
      } */
      .question{
        margin-right: 40px;
        overflow: hidden;
      }
    }
    .qa-cneter{
      padding: 10px;
      .answer{
        max-height: 34px;
        transition: max-height .2s;
        overflow: hidden;
        &.active{
          max-height: 1000px;
        }
      }
    }
  }
}
</style>
