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.

85 lines
1.6 KiB

2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <div :class="['tw-head-body tw-text-base-primary tw-font-[600] md:tw-body-3']">
  4. Q{{ item.Question }}
  5. </div>
  6. <div v-show="show" class="tw-head-body tw-text-base-primary tw-font-normal tw-mt-[6px] md:tw-text-[16px]">
  7. A{{ item.Answer }}
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. props: {
  14. item: {
  15. type: Object,
  16. },
  17. },
  18. data() {
  19. return {
  20. show: true,
  21. window: {
  22. width: 0,
  23. },
  24. };
  25. },
  26. created() {
  27. if (process.browser) {
  28. window.addEventListener("resize", this.handleResize);
  29. }
  30. this.handleResize();
  31. },
  32. mounted() {
  33. // if (this.window.width >= 768) {
  34. // this.show = true;
  35. // }
  36. },
  37. methods: {
  38. handleResize() {
  39. if (process.browser) {
  40. this.window.width = window.innerWidth;
  41. }
  42. },
  43. opendFaq() {
  44. if (this.window.width <= 768) {
  45. this.show = !this.show;
  46. } else {
  47. this.show = true;
  48. }
  49. },
  50. },
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. .seeMore {
  55. position: relative;
  56. &::after {
  57. content: "";
  58. display: inline-block;
  59. position: absolute;
  60. top: 0;
  61. right: 0;
  62. background-image: url("~/assets/svg/arrow-down-primary.svg");
  63. background-position: center center;
  64. background-repeat: no-repeat;
  65. background-size: 100%;
  66. width: 9px;
  67. height: 6px;
  68. margin-left: 16px;
  69. transition: all 0.2s linear;
  70. }
  71. &.open {
  72. &::after {
  73. transform: rotate(180deg);
  74. }
  75. }
  76. @media screen and (min-width: 768px) {
  77. &::after {
  78. display: none;
  79. }
  80. }
  81. }
  82. </style>