index.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div>
  3. <div v-if="domesticList.length == 0">
  4. <van-loading />
  5. </div>
  6. <div v-else>
  7. <listContentVue :main="domesticList"></listContentVue>
  8. <listContentVue :main="varietyList"></listContentVue>
  9. <listContentVue :main="americanList"></listContentVue>
  10. </div>
  11. </div>
  12. </template>
  13. <script>
  14. import listContentVue from '../../components/listContent.vue';
  15. import {
  16. Domestic,
  17. Variety,
  18. American
  19. } from '../../api/user.js';
  20. export default {
  21. onLoad() {
  22. this.getList();
  23. },
  24. data() {
  25. return {
  26. domesticList:[],
  27. varietyList:[],
  28. americanList:[]
  29. }
  30. },
  31. components:{
  32. listContentVue
  33. },
  34. methods:{
  35. async getList () {
  36. let newList = [this.getList1(),this.getList2(),this.getList3()];
  37. let [data1,data2,data3] = await Promise.allSettled(newList);
  38. this.domesticList = data1;
  39. this.varietyList = data2;
  40. this.americanList = data3;
  41. },
  42. async getList1() {
  43. return await Domestic()
  44. },
  45. async getList2() {
  46. return await Variety()
  47. },
  48. async getList3() {
  49. return await American()
  50. }
  51. }
  52. }
  53. </script>
  54. <style>
  55. </style>