surveyBox.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <n-card :title="title" class="survey-box" @click="handleDetail">
  3. {{ content }}
  4. <template #footer>
  5. {{ time }}
  6. </template>
  7. </n-card>
  8. </template>
  9. <script setup>
  10. import { useRouter } from "vue-router";
  11. const router = useRouter();
  12. defineOptions({
  13. name: "survey-box",
  14. });
  15. const props = defineProps({
  16. id: {
  17. type: [String, Number],
  18. default: () => "",
  19. },
  20. title: {
  21. type: String,
  22. default: () => "",
  23. },
  24. content: {
  25. type: String,
  26. default: () => "",
  27. },
  28. time: {
  29. type: String,
  30. default: () => "",
  31. },
  32. });
  33. const handleDetail = () => {
  34. if (props.id) {
  35. router.push("/survey-detail/" + props.id);
  36. } else {
  37. console.warn("missing id");
  38. }
  39. };
  40. </script>
  41. <style lang="scss" scoped>
  42. .n-card.survey-box {
  43. --n-title-font-weight: 600 !important;
  44. --n-title-font-size: 1.75rem !important;
  45. border-radius: 1.875rem;
  46. box-shadow: var(--main-box-shadow);
  47. // background-image: url("/img/notice_list_bg.png");
  48. background-size: contain;
  49. background-repeat: no-repeat;
  50. cursor: pointer;
  51. // background-color: transparent;
  52. }
  53. </style>