home.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view class="home">
  3. 首页
  4. <listContent :main='domesticList'></listContent>
  5. <listContent :main='domesticList'></listContent>
  6. <listContent :main='domesticList'></listContent>
  7. </view>
  8. </template>
  9. <script setup>
  10. import { onMounted,toRefs,ref } from 'vue';
  11. import {Domestic,Variety,American} from '../../api/user.js';
  12. import listContent from '../../components/listContent.vue';
  13. onMounted(() => {
  14. getMain();
  15. })
  16. let domesticList = ref({});
  17. async function getMain() {
  18. console.log("走进来");
  19. let newList = [getList1(),getList2(),getList3()];
  20. console.log(newList,'列表')
  21. let [data1,data2,data3] = await Promise.allSettled(newList);
  22. domesticList.value = data1.value
  23. console.log(domesticList.value,'123')
  24. // Domestic().then(res => {
  25. // console.log("1212")
  26. // console.log(res,'res')
  27. // })
  28. }
  29. async function getList1() {
  30. return Domestic();
  31. }
  32. async function getList2() {
  33. return Variety();
  34. }
  35. async function getList3() {
  36. return American();
  37. }
  38. </script>
  39. <style>
  40. </style>