OverallProgress.vue 875 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <div class="progress-container">
  3. <i-progress :percent="progressNum" :stroke-width="20" status="active" hide-info>
  4. </i-progress>
  5. <span>{{progress}}</span>
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. name: "OverallProgress",
  11. data() {
  12. return {};
  13. },
  14. props: {
  15. examQuestionList: Array
  16. },
  17. async mounted() {},
  18. computed: {
  19. progressNum() {
  20. return (
  21. 100 *
  22. this.examQuestionList.filter(q => q.stuAnswer).length /
  23. this.examQuestionList.length
  24. );
  25. },
  26. progress: function() {
  27. return `${this.examQuestionList.filter(q => q.stuAnswer).length} / ${
  28. this.examQuestionList.length
  29. }`;
  30. }
  31. }
  32. };
  33. </script>
  34. <style scoped>
  35. .progress-container {
  36. display: grid;
  37. justify-self: flex-start;
  38. place-items: center;
  39. grid-template-columns: 200px 50px;
  40. width: 250px;
  41. }
  42. </style>