views.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="wrapper">
  3. <!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
  4. <div v-for="(item,index) in pageData.list" :key="index">
  5. <u-navbar v-if="item.type == 'search'" :is-back="false">
  6. <search style="width:100%" :res="item.options" />
  7. </u-navbar>
  8. <carousel v-if="item.type == 'carousel'" :res="item.options" />
  9. <titleLayout v-if="item.type == 'title'" :res="item.options" />
  10. <leftOneRightTwo v-if="item.type == 'leftOneRightTwo'" :res="item.options" />
  11. <leftTwoRightOne v-if="item.type == 'leftTwoRightOne'" :res="item.options" />
  12. <topOneBottomTwo v-if="item.type == 'topOneBottomTwo'" :res="item.options" />
  13. <topTwoBottomOne v-if="item.type == 'topTwoBottomOne'" :res="item.options" />
  14. <flexThree v-if="item.type == 'flexThree'" :res="item.options" />
  15. <flexFive v-if="item.type == 'flexFive'" :res="item.options" />
  16. <flexFour v-if="item.type == 'flexFour'" :res="item.options" />
  17. <flexTwo v-if="item.type == 'flexTwo'" :res="item.options" />
  18. <textPicture v-if="item.type == 'textPicture'" :res="item.options" />
  19. <menuLayout v-if="item.type == 'menu'" :res="item.options" />
  20. <joinGroup v-if="item.type == 'joinGroup'" :res="item.options" />
  21. <flexOne v-if="item.type == 'flexOne'" :res="item.options" />
  22. <goods v-if="item.type == 'goods'" :res="item.options" />
  23. <integral v-if="item.type == 'integral'" :res="item.options" />
  24. <spike v-if="item.type == 'spike'" :res="item.options" />
  25. <group v-if="item.type == 'group'" :res="item.options" />
  26. </div>
  27. <u-no-network></u-no-network>
  28. </div>
  29. </template>
  30. <script>
  31. // 引用组件
  32. import tpl_banner from "@/pages/tabbar/home/template/tpl_banner";
  33. import tpl_title from "@/pages/tabbar/home/template/tpl_title";
  34. import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two";
  35. import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one";
  36. import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two";
  37. import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one";
  38. import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one";
  39. import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two";
  40. import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three";
  41. import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five";
  42. import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four";
  43. import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture";
  44. import tpl_menu from "@/pages/tabbar/home/template/tpl_menu";
  45. import tpl_search from "@/pages/tabbar/home/template/tpl_search";
  46. import tpl_join_group from "@/pages/tabbar/home/template/tpl_join_group";
  47. import tpl_integral from "@/pages/tabbar/home/template/tpl_integral";
  48. import tpl_spike from "@/pages/tabbar/home/template/tpl_spike";
  49. import tpl_group from "@/pages/tabbar/home/template/tpl_group";
  50. import tpl_ad_list from "@/pages/tabbar/home/template/tpl_view_list";
  51. import tpl_activity_list from "@/pages/tabbar/home/template/tpl_view_list";
  52. import tpl_goods from "@/pages/tabbar/home/template/tpl_goods";
  53. // 结束引用组件
  54. import { getFloorData } from "@/api/home";
  55. export default {
  56. data() {
  57. return {
  58. pageData: "",
  59. };
  60. },
  61. components: {
  62. carousel: tpl_banner,
  63. titleLayout: tpl_title,
  64. leftOneRightTwo: tpl_left_one_right_two,
  65. leftTwoRightOne: tpl_left_two_right_one,
  66. topOneBottomTwo: tpl_top_one_bottom_two,
  67. topTwoBottomOne: tpl_top_two_bottom_one,
  68. flexThree: tpl_flex_three,
  69. flexFive: tpl_flex_five,
  70. flexFour: tpl_flex_four,
  71. flexTwo: tpl_flex_two,
  72. textPicture: tpl_text_picture,
  73. menuLayout: tpl_menu,
  74. search: tpl_search,
  75. joinGroup: tpl_join_group,
  76. flexOne: tpl_flex_one,
  77. goods: tpl_goods,
  78. integral: tpl_integral,
  79. spike: tpl_spike,
  80. group: tpl_group,
  81. tpl_ad_list,
  82. tpl_activity_list,
  83. },
  84. mounted() {
  85. this.init();
  86. },
  87. methods: {
  88. /**
  89. * 实例化首页数据楼层
  90. */
  91. init() {
  92. getFloorData().then((res) => {
  93. if (res.data.success) {
  94. this.pageData = JSON.parse(res.data.result.pageData);
  95. }
  96. });
  97. },
  98. },
  99. };
  100. </script>
  101. <style>
  102. </style>