RightSidebar.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <nav class="right-sidebar">
  3. <ul class="student-list">
  4. <li
  5. v-for="{ student_id, student_name, student_image_url } in studentList"
  6. :key="student_id"
  7. :class="['student-list-item', { active: curStudentId === student_id }]"
  8. @click="getCSItemTaskList(student_id)"
  9. >
  10. <el-avatar icon="el-icon-user" :size="32" :src="student_image_url" /> <span>{{ student_name }}</span>
  11. </li>
  12. </ul>
  13. </nav>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'RightSidebar'
  18. };
  19. </script>
  20. <script setup>
  21. defineProps({
  22. studentList: {
  23. type: Array,
  24. required: true
  25. },
  26. curStudentId: {
  27. type: String,
  28. required: true
  29. },
  30. getCSItemTaskList: {
  31. type: Function,
  32. required: true
  33. }
  34. });
  35. </script>
  36. <style lang="scss" scoped>
  37. .right-sidebar {
  38. width: 180px;
  39. background-color: #f7f7f7;
  40. border-left: 1px solid $border-color;
  41. .student-list {
  42. &-item {
  43. display: flex;
  44. column-gap: 8px;
  45. height: 48px;
  46. padding: 8px;
  47. line-height: 32px;
  48. color: #fff;
  49. cursor: pointer;
  50. border-radius: 2px;
  51. &.active {
  52. background-color: #5498ff;
  53. }
  54. }
  55. }
  56. }
  57. </style>