index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <home-frame @toPath="toPath">
  3. <view class="main">
  4. <view class="one">
  5. <view class="list" v-for="(item,index) in list" :key="index">
  6. <image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  7. </image>
  8. <view class="name textOver">
  9. {{item.title}}
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </home-frame>
  15. </template>
  16. <script>
  17. import homeFrame from "../components/home-frame.vue";
  18. export default {
  19. components: {
  20. homeFrame
  21. },
  22. data() {
  23. return {
  24. list: []
  25. };
  26. },
  27. onLoad() {
  28. const that = this;
  29. that.search()
  30. },
  31. onShow() {
  32. },
  33. methods: {
  34. async search() {
  35. const that = this;
  36. // 轮播图
  37. let res;
  38. res = await that.$api('appapk', 'GET', {
  39. is_use: '0',
  40. limit: 100
  41. });
  42. if (res.errcode == '0') {
  43. that.$set(that, `list`, res.data)
  44. }
  45. },
  46. // 跳转页面
  47. toPath(e) {
  48. let url = `/${e.route}`;
  49. if (e.type == '0') uni.navigateTo({
  50. url
  51. })
  52. else if (e.type == '1') uni.redirectTo({
  53. url
  54. })
  55. else if (e.type == '2') uni.reLaunch({
  56. url
  57. })
  58. else if (e.type == '3') uni.switchTab({
  59. url
  60. })
  61. }
  62. },
  63. };
  64. </script>
  65. <style lang="scss">
  66. .main {
  67. background-color: var(--rgb000);
  68. display: flex;
  69. flex-direction: column;
  70. width: 100vw;
  71. height: 92vh;
  72. .one {
  73. padding: 8px;
  74. display: flex;
  75. flex-wrap: wrap;
  76. justify-content: space-between;
  77. background-color: var(--rgb000);
  78. .list {
  79. width: 18%;
  80. margin: 0 0 10px 0;
  81. .image {
  82. width: 100%;
  83. height: 62px;
  84. overflow: hidden;
  85. border-radius: 5px;
  86. }
  87. .name {
  88. font-size: 12px;
  89. color: var(--rgbfff);
  90. text-align: center;
  91. }
  92. }
  93. }
  94. }
  95. </style>