index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="container">
  3. <uni-card class="card card2" v-for="(item, index) in policyList" :key="index" @click="policyBtn(item)">
  4. <image class="cover" :src="item.url"></image>
  5. <h2>{{ item.title }}</h2>
  6. <text class="cardText">{{ item.text }}</text>
  7. </uni-card>
  8. </view>
  9. </template>
  10. <script>
  11. import requestLogin from '../../api/login.js';
  12. export default {
  13. data() {
  14. return {
  15. policyList: []
  16. }
  17. },
  18. async mounted() {
  19. const config = await requestLogin.getJson();
  20. const { list, bannerList, policyList } = config.data;
  21. this.policyList = policyList;
  22. },
  23. onShow: function() {},
  24. methods: {
  25. policyBtn(e) {
  26. uni.navigateTo({ url: e.path });
  27. },
  28. },
  29. // 页面生命周期中onReachBottom(页面滚动到底部的事件)
  30. onReachBottom() {}
  31. }
  32. </script>
  33. <style>
  34. .container {
  35. display: flex;
  36. flex-wrap: wrap;
  37. }
  38. .card {
  39. display: block;
  40. margin: 10px;
  41. width: 27%;
  42. }
  43. .cover {
  44. display: block;
  45. width: 40px;
  46. height: 40px;
  47. margin: 5px auto;
  48. }
  49. .uni-card {
  50. padding: 0 !important;
  51. margin: 0 !important;
  52. }
  53. .uni-card__content {
  54. padding: 0 !important;
  55. }
  56. h2 {
  57. font-weight: 700;
  58. width: 100%;
  59. text-align: center;
  60. font-size: 16px;
  61. }
  62. .cardText {
  63. display: block;
  64. width: 100%;
  65. text-align: center;
  66. font-size: 12px;
  67. margin-bottom: 5px;
  68. color: #999;
  69. }
  70. </style>