i-nav-list.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <view>
  3. <view class="line"></view>
  4. <view class="icon_nav">
  5. <view class="nav_list">
  6. <view class="item" v-for="item in navsList" :key="item.id" @click="go_detail(item.link,item.id)">
  7. <view class="item_icon">
  8. <image :src="item.icon"></image>
  9. </view>
  10. <view class="item_name">
  11. <text>{{item.title}}</text>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props:[
  21. "navsList"
  22. ],
  23. data() {
  24. return {
  25. };
  26. },
  27. methods:{
  28. go_detail(link,id){
  29. const href = link + id
  30. console.log(href)
  31. uni.navigateTo({
  32. url:"../../i-nav-detail/i-nav-detail",
  33. success: function(res) {
  34. // 通过eventChannel向被打开页面传送数据
  35. res.eventChannel.emit('acceptDataFromOpenerPage', { href: href })
  36. }
  37. })
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss">
  43. .line{
  44. width: 100%;
  45. height: 6rpx;
  46. background-color: #F0F0F0;
  47. }
  48. .icon_nav{
  49. box-sizing: border-box;
  50. padding-top: 24rpx;
  51. padding-left: 55rpx;
  52. padding-right: 55rpx;
  53. .nav_list{
  54. overflow: hidden;
  55. .item{
  56. float: left;
  57. width: 160rpx;
  58. text-align: center;
  59. margin-bottom: 42rpx;
  60. .item_icon{
  61. margin: 0 auto;
  62. width: 94rpx;
  63. height: 94rpx;
  64. image{
  65. width: 94rpx;
  66. height: 94rpx;
  67. }
  68. }
  69. .item_name{
  70. margin-top: 18rpx;
  71. height: 34rpx;
  72. font-size: 25rpx;
  73. font-family: PingFangSC-Regular, PingFang SC;
  74. font-weight: 400;
  75. color: #455A64;
  76. line-height: 34rpx;
  77. }
  78. }
  79. }
  80. }
  81. </style>