use-list-title.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <view :class="type == 'round' ? 'padding-lr-sm' : ''">
  3. <!-- 列表标题 -->
  4. <view class="use-list-title dflex-b padding-lr w-full bg-main" :class="type == 'round' ? 'border-radius' : ''" @click="goto">
  5. <view class="dflex">
  6. <!--
  7. <view v-if="iconfont[index] && iconfont[index] != ' '" class="iconfont __left margin-right-sm" :class="iconfont[index]" :style="{ color: color }"></view>
  8. -->
  9. <text :style="{fontSize: size + 'rpx', fontWeight: fwt }">{{ title }}</text>
  10. </view>
  11. <view class="dflex">
  12. <text v-if="tip" class="tip margin-right-xs">{{tip}}</text>
  13. <view class="iconfont fs-sm" :class="rightIcon" :style="{ color: rightColor }"></view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. type: {
  22. type: String,
  23. default: 'square'
  24. },
  25. title: {
  26. type: String,
  27. default: '列表标题'
  28. },
  29. size: {
  30. type: String,
  31. default: '28'
  32. },
  33. fwt: {
  34. type: String,
  35. default: 'normal'
  36. },
  37. tip: {
  38. type: [String, Number],
  39. default: ''
  40. },
  41. index : {
  42. type: Number,
  43. default: 0
  44. },
  45. color: {
  46. type: String,
  47. default: '#C0C4CC'
  48. },
  49. rightIcon: {
  50. type: String,
  51. default: 'iconjiantou-01'
  52. },
  53. rightColor: {
  54. type: String,
  55. default: '#c0c0c0'
  56. }
  57. },
  58. data() {
  59. return {
  60. iconfont : ['iconpailie', 'iconpailie02', 'iconhuiyuan', 'iconremen', 'iconjian', 'iconjia', 'iconzuji', 'iconshezhi-', 'iconshoucang-', 'icondizhi-', 'iconcart', 'icongouwuche-', 'iconhome', 'iconshouye-', 'iconuser'],
  61. };
  62. },
  63. methods: {
  64. goto() {
  65. console.log('goto');
  66. this.$emit('goto', {
  67. type: 'goto'
  68. });
  69. }
  70. }
  71. };
  72. </script>
  73. <style lang="scss">
  74. .use-list-title {
  75. height: 100rpx;
  76. line-height: 100rpx;
  77. border-radius: 9px;
  78. }
  79. .use-list-title {
  80. .__left{
  81. font-size: $font-lg + 8upx;
  82. }
  83. .iconfont {
  84. color: #c0c0c0;
  85. }
  86. .tip {
  87. font-size: $font-sm;
  88. color: #c0c0c0;
  89. }
  90. }
  91. </style>