list-cell.vue 2.3 KB

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