gui-box-banner.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view
  3. class="grace-box-banner gui-flex gui-rows gui-nowrap"
  4. :class="customClass"
  5. :style="{
  6. paddingTop:padding,
  7. paddingBottom:padding,
  8. borderRadius:borderRadius
  9. }">
  10. <view
  11. class="grace-box-items gui-flex gui-rows gui-nowrap gui-align-items-center"
  12. hover-class="gui-tap"
  13. v-for="(item, index) in items"
  14. :key="index"
  15. @tap.stop="taped(index)">
  16. <view
  17. class="gui-flex1">
  18. <view
  19. class="gui-flex gui-rows gui-nowrap gui-justify-content-center gui-align-items-center">
  20. <text
  21. class="gui-block"
  22. :class="colors[0]"
  23. :style="{
  24. lineHeight:lineHeight,
  25. fontSize:fontSize[0]
  26. }">{{item[0]}}</text>
  27. <text
  28. class="gui-block"
  29. :class="colors[1]"
  30. :style="{
  31. fontSize:fontSize[1],
  32. marginLeft:'5rpx'
  33. }">{{item[1]}}</text>
  34. </view>
  35. <text
  36. class="gui-block gui-text-center"
  37. :class="colors[2]"
  38. :style="{
  39. fontSize:fontSize[2]
  40. }">{{item[2]}}</text>
  41. </view>
  42. <view
  43. class="grace-box-line"
  44. :style="{
  45. 'height' : borderHeight,
  46. 'border-right-width': borderWidth,
  47. 'border-right-style': borderStyle,
  48. 'border-right-color': borderColor
  49. }"
  50. v-if="index < items.length - 1"></view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. name : "gui-box-banner",
  57. props : {
  58. items:{
  59. type : Array,
  60. default : function () {
  61. return []
  62. }
  63. },
  64. colors:{
  65. type : Array,
  66. default : function () {
  67. return [
  68. ['gui-primary-text'],
  69. ['gui-color-gray'],
  70. ['gui-color-gray'],
  71. ]
  72. }
  73. },
  74. fontSize:{
  75. type : Array,
  76. default : function () {
  77. return ['36rpx', '24rpx', '24rpx']
  78. }
  79. },
  80. customClass : {
  81. type : Array,
  82. default : function(){
  83. return ['gui-bg-white', 'gui-dark-bg-level-3'];
  84. }
  85. },
  86. padding:{
  87. type : String,
  88. default : '20rpx'
  89. },
  90. borderRadius:{
  91. type : String,
  92. default : '10rpx'
  93. },
  94. lineHeight:{
  95. type : String,
  96. default : '60rpx'
  97. },
  98. borderColor : {type:String, default:'#F1F1F1'},
  99. borderWidth : {type:String, default:'1px'},
  100. borderStyle : {type:String, default:'solid'},
  101. borderHeight: {type:String, default:'60rpx'}
  102. },
  103. methods:{
  104. taped:function (index) {
  105. this.$emit('taped', index);
  106. }
  107. },
  108. emits : ['taped']
  109. }
  110. </script>
  111. <style scoped>
  112. .grace-box-banner{overflow:hidden;}
  113. .grace-box-items{width:100rpx; flex:1;}
  114. .grace-box-line{width:1px; height:50rpx;}
  115. </style>