question-collection-list.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <template>
  2. <z-paging ref="paging" v-model="list" @query="handleQuery">
  3. <question-preview-list :list="list" hidden-delete/>
  4. </z-paging>
  5. </template>
  6. <script setup>
  7. import {ref} from 'vue'
  8. import QuestionPreviewList from "@/pages/topic-center/topic-collection/components/question-preview-list.vue";
  9. import {favQuestions} from "@/api/webApi/webQue";
  10. import {createPropDefine} from "@/utils";
  11. import {useQuestionTranslate} from "@/components/mx-question/useQuestionTranslate";
  12. const props = defineProps({
  13. subjectId: createPropDefine(0, [Number, String])
  14. })
  15. const list = ref([])
  16. const paging = ref(null)
  17. const handleQuery = function (pageNum, pageSize) {
  18. const params = {pageNum, pageSize, type: 'question', subjectId: props.subjectId}
  19. favQuestions(params)
  20. .then(res => {
  21. // 转成标准格式,以供mx-question-content/parse使用,以共享MathJax特性
  22. const rows = res.rows.map(useQuestionTranslate)
  23. paging.value.completeByTotal(rows, res.total)
  24. })
  25. .catch(e => paging.value.complete(false))
  26. }
  27. </script>
  28. <style scoped>
  29. </style>