gui-box-banner.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="grace-box-banner gui-flex gui-rows gui-nowrap"
  3. :style="{backgroundColor:background,
  4. paddingTop:padding,
  5. paddingBottom:padding,
  6. borderRadius:borderRadius}">
  7. <view class="grace-box-items gui-border-r"
  8. v-for="(item, index) in items"
  9. :key="index" @tap.stop="taped(index)"
  10. :style="{
  11. borderRightWidth : index+1 >= items.length ? '0rpx':'1px',
  12. borderColor : borderColor
  13. }">
  14. <view class="gui-flex gui-rows gui-nowrap gui-justify-content-center gui-align-items-center">
  15. <text class="gui-block-text"
  16. :style="{
  17. lineHeight:lineHeight,
  18. color:color[0],
  19. fontSize:fontSize[0]
  20. }">{{item[0]}}</text>
  21. <text class="gui-block-text"
  22. :style="{color:color[1], fontSize:fontSize[1], marginLeft:'5rpx'}">{{item[1]}}</text>
  23. </view>
  24. <text class="gui-block-text gui-text-center"
  25. :style="{color:color[2],fontSize:fontSize[2]}">{{item[2]}}</text>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. name : "gui-box-banner",
  32. props : {
  33. items:{
  34. type : Array,
  35. default : function () {
  36. return []
  37. }
  38. },
  39. color:{
  40. type : Array,
  41. default : function () {
  42. return ['#333333', 'rgba(69, 90, 100, 0.5)', 'rgba(69, 90, 100, 0.5)']
  43. }
  44. },
  45. fontSize:{
  46. type : Array,
  47. default : function () {
  48. return ['36rpx', '24rpx', '24rpx']
  49. }
  50. },
  51. background : {
  52. type : String,
  53. default : ''
  54. },
  55. padding:{
  56. type : String,
  57. default : '20rpx'
  58. },
  59. borderRadius:{
  60. type : String,
  61. default : '10rpx'
  62. },
  63. lineHeight:{
  64. type : String,
  65. default : '60rpx'
  66. },
  67. borderColor : {type:String, default:'#F1F1F1'}
  68. },
  69. methods:{
  70. taped:function (index) {
  71. this.$emit('taped', index);
  72. }
  73. }
  74. }
  75. </script>
  76. <style scoped>
  77. .grace-box-banner{overflow:hidden;}
  78. .grace-box-items{width:100rpx; flex:1;}
  79. </style>