mix-list-cell.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="content">
  3. <button v-if="openType" :open-type="openType" class="btn"></button>
  4. <view class="mix-list-cell" :class="border" @click="eventClick" hover-class="cell-hover" :hover-stay-time="50">
  5. <text v-if="icon" class="cell-icon yticon" :style="[{
  6. color: iconColor,
  7. }]" :class="icon"></text>
  8. <text class="cell-tit clamp">{{title}}</text>
  9. <text v-if="tips" class="cell-tip">{{tips}}</text>
  10. <text class="cell-more yticon" :class="typeList[navigateType]"></text>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. /**
  16. * 简单封装了下, 应用范围比较狭窄,可以在此基础上进行扩展使用
  17. * 比如加入image, iconSize可控等
  18. */
  19. export default {
  20. data() {
  21. return {
  22. typeList: {
  23. left: 'icon-zuo',
  24. right: 'icon-you',
  25. up: 'icon-shang',
  26. down: 'icon-xia'
  27. },
  28. }
  29. },
  30. props: {
  31. openType: {
  32. type: String,
  33. default: ''
  34. },
  35. icon: {
  36. type: String,
  37. default: ''
  38. },
  39. title: {
  40. type: String,
  41. default: '标题'
  42. },
  43. tips: {
  44. type: String,
  45. default: ''
  46. },
  47. navigateType: {
  48. type: String,
  49. default: 'right'
  50. },
  51. border: {
  52. type: String,
  53. default: 'b-b'
  54. },
  55. hoverClass: {
  56. type: String,
  57. default: 'cell-hover'
  58. },
  59. iconColor: {
  60. type: String,
  61. default: '#333'
  62. }
  63. },
  64. methods: {
  65. eventClick() {
  66. this.$emit('eventClick');
  67. }
  68. },
  69. }
  70. </script>
  71. <style lang='scss'>
  72. .icon .mix-list-cell.b-b:after {
  73. left: 90upx;
  74. }
  75. .mix-list-cell {
  76. display: flex;
  77. align-items: baseline;
  78. background: #FFFFFF;
  79. padding-left: 20upx;
  80. padding: 20upx $page-row-spacing;
  81. line-height: 60upx;
  82. position: relative;
  83. &.cell-hover {
  84. background: #fafafa;
  85. }
  86. &.b-b:after {
  87. left: 30upx;
  88. }
  89. .cell-icon {
  90. align-self: center;
  91. width: 56upx;
  92. max-height: 60upx;
  93. font-size: 38upx;
  94. }
  95. .cell-more {
  96. align-self: center;
  97. font-size: 30upx;
  98. color: $font-color-base;
  99. margin-left: $uni-spacing-row-sm;
  100. }
  101. .cell-tit {
  102. flex: 1;
  103. font-size: $font-base;
  104. color: $font-color-dark;
  105. margin-right: 10upx;
  106. }
  107. .cell-tip {
  108. border-top: #909399;
  109. font-size: $font-sm+2upx;
  110. color: $font-color-light;
  111. }
  112. }
  113. .btn::after {
  114. display: none;
  115. }
  116. .btn {
  117. width: 95%;
  118. position: absolute;
  119. opacity: 0;
  120. z-index: 99;
  121. }
  122. </style>