index.vue 1.9 KB

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