icon-nav.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view>
  3. <view v-if="propData.length > 0" class="icon-nav-list">
  4. <view v-for="(item, index) in propData" :key="index" class="item">
  5. <view :class="'item-content '+((item.bg_color || null) == null ? 'item-exposed' : '')" :data-value="item.event_value" :data-type="item.event_type" @tap="navigation_event" :style="((item.bg_color || null) == null ? '' : 'background-color:'+item.bg_color+';')">
  6. <image :src="item.images_url" mode="aspectFit"></image>
  7. </view>
  8. <view class="title">{{item.name}}</view>
  9. </view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. const app = getApp();
  15. export default {
  16. data() {
  17. return {};
  18. },
  19. components: {},
  20. props: {
  21. propData: Array
  22. },
  23. methods: {
  24. navigation_event(e) {
  25. app.globalData.operation_event(e);
  26. }
  27. }
  28. };
  29. </script>
  30. <style>
  31. .icon-nav-list {
  32. overflow: hidden;
  33. margin-bottom: 20rpx;
  34. }
  35. .icon-nav-list .item {
  36. width: calc(20% - 20rpx);
  37. float: left;
  38. padding: 20rpx 10rpx 0 10rpx;
  39. /* #ifdef H5 */
  40. cursor: pointer;
  41. /* #endif */
  42. }
  43. .icon-nav-list .item .item-content {
  44. border-radius: 50%;
  45. padding: 20rpx;
  46. text-align: center;
  47. margin: 0 auto;
  48. -webkit-box-shadow: 0 2px 12px rgb(226 226 226 / 95%);
  49. box-shadow: 0 2px 12px rgb(226 226 226 / 95%);
  50. }
  51. .icon-nav-list .item .item-content,
  52. .icon-nav-list .item image {
  53. width: 50rpx !important;
  54. height: 50rpx !important;
  55. }
  56. .icon-nav-list .item .item-exposed {
  57. padding: 0;
  58. -webkit-box-shadow: none;
  59. box-shadow: none;
  60. }
  61. .icon-nav-list .item .item-exposed,
  62. .icon-nav-list .item .item-exposed image {
  63. width: 90rpx !important;
  64. height: 90rpx !important;
  65. }
  66. .icon-nav-list .item .title {
  67. margin-top: 6rpx;
  68. font-size: 28rpx;
  69. text-align: center;
  70. -o-text-overflow: ellipsis;
  71. text-overflow: ellipsis;
  72. overflow: hidden;
  73. white-space: nowrap;
  74. max-width: 100%;
  75. color: #888;
  76. }
  77. </style>