FAQItem.vue 2.2 KB
<template>
  <div :class="['share-item', { hideBorder }, { indexType }]">
    <div class="faq-item">
      <div class="q flex">
        <template v-if="indexType">
          <div class="icon text-center">问</div>
        </template>
        <template v-else>
          <div class="sprite-icon icon-faq-left"></div>
        </template>
        <div :class="['value', { 'text-hide': indexType }]">{{ item.question }}</div>
      </div>
      <div class="a flex">
        <template v-if="indexType">
          <div class="icon text-center">答</div>
        </template>
        <template v-else>
          <div class="sprite-icon icon-faq-right"></div>
        </template>
        <div :class="['value', { 'text-hide': indexType }]">{{ item.answer }}</div>
      </div>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  name: 'FAQItem',
  props: {
    hideBorder: Boolean,
    indexType: Boolean,
    item: {
      type: Object,
      default: () => { }
    }
  },
  data () {
    return {
    }
  },
  mounted () {
  },
  methods: {
  }
}
</script>

<style scoped lang="scss">
@import '@/assets/css/sharegoods.scss';
.faq-item {
  padding-top: 16px;
  .flex {
    margin-bottom: 12px;
    align-items: flex-start;
    .sprite-icon {
      margin-right: 8px;
      flex-shrink: 0;
    }
  }
  .icon {
    color: #ffffff;
    font-size: 12px;
    width: 14px;
    height: 14px;
    background: linear-gradient(108deg, #ffbe68 0%, #ff5446 60%, #f45454 100%);
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: 4px;
  }
  .q {
    .value {
      font-weight: 500;
      font-size: 16px;
      color: #2c2c2c;
    }
  }
  .a {
    .value {
      font-size: 14px;
      color: #282829;
    }
    .icon {
      background: linear-gradient(108deg, #4f7bf6 0%, #3d6ced 60%, #3162e6 100%);
    }
  }
  .value {
    line-height: 20px;
    line-break: anywhere;
    word-break: break-all;
  }
}
.indexType {
  .faq-item {
    padding-top: 0;
  }
  .flex {
    margin-bottom: 0;
    align-items: center;
  }
  .q {
    margin-bottom: 6px;
    &:last-of-type {
      margin-bottom: 0;
    }
    .value {
      color: #2c2c2c;
    }
  }
  .value {
    font-weight: 400;
    font-size: 12px !important;
  }
}
</style>