classify-1.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <view class="classify">
  3. <view class="classify-li" v-for="(item, index) in list" :key="index" @click="downLoad(item.link)">
  4. <image class="classify-li__img" :src="url+item.imgPath" alt=""></image>
  5. <view class="classify-li__text">
  6. {{ item.text }}
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: 'Classify1',
  14. props: {
  15. list: {
  16. type: Array,
  17. default: () => []
  18. },
  19. url: {
  20. type: String,
  21. }
  22. },
  23. data() {
  24. return {
  25. baseURL: uni.$BASE_URL
  26. }
  27. },
  28. methods: {
  29. // 打开自定义链接
  30. openCustomLink(link = '') {
  31. console.log(`link: ${link}`)
  32. },
  33. downLoad(item) {
  34. if (item) {
  35. let url = encodeURIComponent(item)
  36. uni.navigateTo({
  37. url: '../../pages/home/myWebView?url=' + url
  38. })
  39. }
  40. },
  41. }
  42. }
  43. </script>
  44. <style scoped lang="scss">
  45. .classify {
  46. display: flex;
  47. justify-content: flex-start;
  48. flex-wrap: wrap;
  49. padding: 14upx 24upx 8rpx;
  50. .classify-li {
  51. flex: 0 0 20%;
  52. font-size: 24upx;
  53. &__img {
  54. display: block;
  55. width: 98upx;
  56. height: 98upx;
  57. margin: auto;
  58. }
  59. &__text {
  60. display: block;
  61. color: #5a5a5a;
  62. text-align: center;
  63. margin: 8upx 0 14upx 0;
  64. }
  65. }
  66. }
  67. </style>