Answer.vue 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div
  3. class="answer-box animate__animated animate__bounceInUp"
  4. :class="{active: active}"
  5. @click="$emit('click')"
  6. >
  7. <div>{{opt}}</div>
  8. <div class="answer-box-gutter">{{label}}</div>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'Answer',
  14. props: {
  15. active: Boolean,
  16. option: String,
  17. label: String
  18. },
  19. computed: {
  20. opt() {
  21. switch (this.option) {
  22. case 'true':
  23. return ''
  24. case 'false':
  25. return ''
  26. default:
  27. return this.option ? `${this.option}:` : ''
  28. }
  29. }
  30. }
  31. }
  32. </script>
  33. <style lang="less" scoped>
  34. .answer-box {
  35. background-color: #f6f6f8;
  36. color: #4e5053;
  37. border-radius: 100px;
  38. display: flex;
  39. align-items: center;
  40. margin-bottom: 25px;
  41. font-size: 14px;
  42. font-weight: 400;
  43. padding: 1em 2em;
  44. // height: 40px;
  45. & + & {
  46. margin-top: 26px;
  47. text-align-last: left;
  48. }
  49. &-gutter {
  50. margin-left: 1em;
  51. line-height: 1.4em;
  52. }
  53. &.active {
  54. background-color: #409eff;
  55. color: #fff;
  56. }
  57. }
  58. </style>