list-cell.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view
  3. class="tui-cell-class tui-list-cell"
  4. :class="{ 'tui-cell-arrow': arrow, 'tui-cell-last': last, 'tui-line-left': lineLeft, 'tui-line-right': lineRight, 'tui-radius': radius }"
  5. :hover-class="hover ? 'tui-cell-hover' : ''"
  6. :style="{ background: bgcolor, fontSize: size + 'rpx', color: color, padding: padding}"
  7. :hover-stay-time="150"
  8. @tap="handleClick"
  9. >
  10. <slot></slot>
  11. <image src="/static/images/navigator-1.png" class="arrow" v-if="arrow"></image>
  12. <!-- <view class="iconfont iconarrow-right arrow" v-if="arrow"></view> -->
  13. </view>
  14. </template>
  15. <script setup>
  16. import { ref } from 'vue'
  17. const props = defineProps ({
  18. //是否有箭头
  19. arrow: {
  20. type: Boolean,
  21. default: false
  22. },
  23. //是否有点击效果
  24. hover: {
  25. type: Boolean,
  26. default: true
  27. },
  28. //left 30rpx
  29. lineLeft:{
  30. type: Boolean,
  31. default: false
  32. },
  33. //right 30rpx
  34. lineRight:{
  35. type: Boolean,
  36. default: false
  37. },
  38. padding:{
  39. type:String,
  40. default:"26rpx 30rpx"
  41. },
  42. last: {
  43. type: Boolean,
  44. default: false //最后一条数据隐藏线条
  45. },
  46. radius:{
  47. type:Boolean,
  48. default:false
  49. },
  50. bgcolor: {
  51. type: String,
  52. default: "#fff" //背景颜色
  53. },
  54. size: {
  55. type: Number,
  56. default: 28 //字体大小
  57. },
  58. color: {
  59. type: String,
  60. default: "#5A5B5C" //字体颜色
  61. },
  62. index: {
  63. type: Number,
  64. default: 0
  65. }
  66. })
  67. const emit = defineEmits(['click'])
  68. const handleClick = () => {
  69. emit('click', {
  70. index: props.index
  71. });
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .tui-list-cell {
  76. position: relative;
  77. width: 100%;
  78. box-sizing: border-box;
  79. overflow: hidden;
  80. display: flex;
  81. align-items: center;
  82. }
  83. .tui-radius {
  84. border-radius: 12rpx;
  85. overflow: hidden;
  86. }
  87. .tui-cell-hover {
  88. background: #f7f7f9 !important;
  89. }
  90. .tui-list-cell::after {
  91. content: '';
  92. position: absolute;
  93. border-bottom: 2rpx solid #eee;
  94. -webkit-transform: scaleY(0.8);
  95. transform: scaleY(0.8);
  96. bottom: 0;
  97. right: 0;
  98. left: 0;
  99. }
  100. .tui-line-left::after {
  101. left: 30rpx !important;
  102. }
  103. .tui-line-right::after {
  104. right: 30rpx !important;
  105. }
  106. .tui-cell-last::after {
  107. border-bottom: 0 !important;
  108. }
  109. // .arrow {
  110. // font-size: 44rpx;
  111. // line-height: 100%;
  112. // color: $text-color-grey;
  113. // position: relative;
  114. // margin-right: -12rpx;
  115. // }
  116. .arrow {
  117. width: 50rpx;
  118. height: 50rpx;
  119. position: relative;
  120. margin-right: -10rpx;
  121. flex-shrink: 0;
  122. }
  123. </style>