questionCard.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <view class="question-card__wrap">
  3. <view class="question-card__head">
  4. <view class="question-card__head-title">{{ props.datas ? props.datas.title : '' }}</view>
  5. </view>
  6. <view class="question-card__body">
  7. <template v-if="props.datas">
  8. <view class="question-card__item" v-for="(item, index) in props.datas.faq" :key="index" @click="onQuestionSend(item)">
  9. <view class="question-card__item-content">
  10. {{ item }}
  11. </view>
  12. </view>
  13. </template>
  14. </view>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { inject } from 'vue'
  19. const props = defineProps({
  20. datas: {
  21. type: Object,
  22. default() {
  23. return null
  24. }
  25. }
  26. })
  27. const onQuestionSend = inject('onQuestionSend');
  28. </script>
  29. <style lang="less" scoped>
  30. .question-card__wrap {
  31. width: 100%;
  32. height: auto;
  33. padding: 16rpx 24rpx;
  34. border-radius: 20rpx;
  35. background: #FAFAFA;
  36. }
  37. .question-card__head {
  38. width: 100%;
  39. height: 44rpx;
  40. .question-card__head-title {
  41. font-size: 26rpx;
  42. font-weight: 500;
  43. color: #000;
  44. }
  45. }
  46. .question-card__body {
  47. display: flex;
  48. flex-wrap: wrap;
  49. margin-top: 8px;
  50. gap: 20rpx;
  51. .question-card__item {
  52. display: flex;
  53. align-items: center;
  54. justify-content: center;
  55. padding: 16rpx;
  56. background-color: #fff;
  57. border-radius: 12rpx;
  58. border: 1rpx solid #999;
  59. }
  60. .question-card__item-content {
  61. font-size: 26rpx;
  62. color: #000;
  63. }
  64. }
  65. </style>