t-i-icon - 横向可滑动.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="content">
  3. <scroll-view scroll-x="true">
  4. <view class="list">
  5. <view class="item" v-for="(item,index) in iconList" :key="index" @click="go_link(item.link)">
  6. <view class="icon">
  7. <image :src="item.icon" mode=""></image>
  8. </view>
  9. <view class="name">{{item.title}}</view>
  10. </view>
  11. </view>
  12. </scroll-view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: "t-i-icon",
  18. props: [
  19. "iconList",
  20. "mine_code"
  21. ],
  22. data() {
  23. return {
  24. };
  25. },
  26. methods: {
  27. go_link(link) {
  28. // console.log(link.split('=')[3].split('&')[0])
  29. // let pageId = link.split('=')[3].split('&')[0]
  30. console.log(link)
  31. let pageId = ""
  32. function GetQueryString(name) {
  33. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  34. var r = link.match(reg);
  35. if (r != null) return unescape(r[2]);
  36. return null;
  37. }
  38. console.log(GetQueryString("pageId"))
  39. if (GetQueryString("pageId")) {
  40. pageId = GetQueryString("pageId")
  41. } else {
  42. pageId = link.split('=')[1]
  43. }
  44. uni.navigateTo({
  45. url: "../../index/record/record?pageId=" + pageId + "&mine_code=" + this.mine_code,
  46. })
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="scss">
  52. .content {
  53. margin-bottom: 30rpx;
  54. background-color: #FFFFFF;
  55. box-sizing: border-box;
  56. padding: 50rpx 25rpx;
  57. }
  58. .list {
  59. display: flex;
  60. .item {
  61. margin-right: 25rpx;
  62. width: 120rpx;
  63. .icon {
  64. width: 120rpx;
  65. text-align: center;
  66. image {
  67. width: 104rpx;
  68. height: 104rpx;
  69. }
  70. }
  71. .name {
  72. width: 120rpx;
  73. text-align: center;
  74. font-size: 30rpx;
  75. white-space: nowrap;
  76. overflow: hidden;
  77. text-overflow: ellipsis;
  78. }
  79. }
  80. .item:last-child {
  81. margin-right: 0;
  82. }
  83. }
  84. </style>