<template>
  <div class="help-center-answer">
    <h2 class="Hc-answer-title">{{ qa.q }}</h2>
    <p class="Hc-answer-content">
      {{ qa.a }}
    </p>
  </div>
</template>
<script>
import QA from "@/api/helpCenter";

export default {
  name: "HelpCenterAnswer",
  data() {
    return {
      qa: {}
    };
  },
  created() {
    const { type, id } = this.$route.params;
    if (Array.isArray(QA[type])) {
      this.qa = QA[type].find(v => v.id === +id);
    } else {
      this.qa = Object.values(QA[type])
        .flat()
        .find(v => +id === v.id);
    }
  }
};
</script>
<style lang="less" src="./index.less" scoped></style>
