score-lianxi-card-lianxi.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="scroll-list-card mobile-card-box">
  3. <!-- title -->
  4. <text class="mobile-card-title">{{ data.lxName === null ? "" : data.lxName }}</text>
  5. <!-- content -->
  6. <view class="mobile-card-row" style="font-size: 28rpx">
  7. 时间:{{ data.lxStartTime === null ? "" : data.lxStartTime }}-{{
  8. data.lxEndTime === null ? "" : data.lxEndTime
  9. }}
  10. </view>
  11. <!-- button -->
  12. <template v-for="item in btns">
  13. <button class="lli-btn" :key="item.index" v-if="data.status == item.status" @click="btnClick(data)">
  14. {{ item.text }}
  15. </button>
  16. </template>
  17. </view>
  18. </template>
  19. <script setup>
  20. import {
  21. toRefs,
  22. ref,
  23. computed
  24. } from "vue";
  25. const props = defineProps({
  26. data: {
  27. type: Object,
  28. },
  29. });
  30. const {
  31. data
  32. } = toRefs(props);
  33. const btns = computed(() => [{
  34. index: 0,
  35. status: 1,
  36. text: "开始练习",
  37. },
  38. {
  39. index: 1,
  40. status: 2,
  41. text: "已结束",
  42. },
  43. ]);
  44. const Emits = defineEmits(['btnClick'])
  45. function btnClick(data) {
  46. Emits('btnClick', data)
  47. }
  48. </script>
  49. <style>
  50. </style>