list.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <div class="app-container" v-loading="loading">
  3. <el-tabs v-model="currentTab">
  4. <el-tab-pane v-for="t in tabs" :label="t.label" :name="t.name">
  5. <component :is="t.page" v-if="t.visited"/>
  6. </el-tab-pane>
  7. </el-tabs>
  8. </div>
  9. </template>
  10. <script setup name="PaperList">
  11. import {useProvideGlobalLoading} from "@/views/hooks/useGlobalLoading.js";
  12. import ListExactIntelligent from "@/views/dz/papers/components/list-exact-intelligent.vue";
  13. import ListFullIntelligent from "@/views/dz/papers/components/list-full-intelligent.vue";
  14. import ListExactHand from "@/views/dz/papers/components/list-exact-hand.vue";
  15. import ListFullHand from "@/views/dz/papers/components/list-full-hand.vue";
  16. const {loading} = useProvideGlobalLoading()
  17. const tabs = ref([{
  18. name: 'ExactIntelligent',
  19. label: '定向智能',
  20. page: markRaw(ListExactIntelligent) ,
  21. visited: true
  22. }, {
  23. name: 'FullIntelligent',
  24. label: '全量智能',
  25. page: markRaw(ListFullIntelligent),
  26. visited: false
  27. }, {
  28. name: 'ExactHand',
  29. label: '定向手动',
  30. page: markRaw(ListExactHand),
  31. visited: false
  32. }, {
  33. name: 'FullHand',
  34. label: '全量手动',
  35. page: markRaw(ListFullHand),
  36. visited: false
  37. }])
  38. const currentTab = ref('ExactIntelligent')
  39. watch(currentTab, tabName => {
  40. // 通过visited=true 延迟渲染
  41. const tab = tabs.value.find(t => t.name == tabName)
  42. if (tab) tab.visited = true
  43. })
  44. </script>
  45. <style lang="scss" scoped></style>