fs-cell-group.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view
  3. class="fs-cell-group"
  4. :class="{ full, radius, 'fs-cell-group-gutter': gutter }"
  5. :style="{ backgroundColor: bgColor || '#fff' }"
  6. >
  7. <slot />
  8. </view>
  9. </template>
  10. <script>
  11. /**
  12. * 单元格组组件
  13. * @description 单元格组组件
  14. * @property {String} titleWidth 标题宽度
  15. * @property {Boolean} arrow 是否显示箭头
  16. * @property {String} arrowColor 箭头颜色
  17. * @property {String} arrowColorType = [primary | danger | warning | info | success] 箭头颜色类型
  18. * @property {Boolean} full 是否通屏
  19. * @property {Boolean} border 是否显示边框
  20. * @property {Boolean} tighten 是否紧凑
  21. * @property {Boolean} gutter 是否显示间距
  22. * @property {Boolean} radius 是否带圆角
  23. * @property {Boolean} reverse 是否翻转
  24. * @property {String} bgColor 背景颜色
  25. * @property {String} align = [top | center | bottom | stretch] 垂直对齐方式
  26. * @property {String} justify = [left | center | right] 水平对齐方式
  27. */
  28. export default {
  29. name: 'fs-cell-group'
  30. }
  31. </script>
  32. <script setup>
  33. import { provide, toRefs } from 'vue'
  34. const props = defineProps({
  35. titleWidth: String,
  36. arrow: Boolean,
  37. arrowColor: {
  38. type: String,
  39. default: ''
  40. },
  41. arrowColorType: {
  42. type: String,
  43. validator(value) {
  44. return ['primary', 'success', 'info', 'warning', 'danger'].includes(value)
  45. }
  46. },
  47. border: Boolean,
  48. tighten: Boolean,
  49. gutter: Boolean,
  50. radius: {
  51. type: Boolean,
  52. default: true
  53. },
  54. reverse: Boolean,
  55. align: {
  56. type: String,
  57. default: 'center',
  58. validator(value) {
  59. return ['top', 'center', 'bottom', 'stretch'].includes(value)
  60. }
  61. },
  62. justify: {
  63. type: String,
  64. default: 'left',
  65. validator(value) {
  66. return ['left', 'center', 'right'].includes(value)
  67. }
  68. },
  69. bgColor: {
  70. type: String
  71. },
  72. full: Boolean
  73. })
  74. provide('cellGroup', props)
  75. </script>
  76. <style lang="scss" scoped>
  77. .fs-cell-group {
  78. margin: 0 var(--gutter);
  79. overflow: hidden;
  80. position: relative;
  81. &::after {
  82. position: absolute;
  83. bottom: 0;
  84. left: 0;
  85. height: 2rpx;
  86. width: 100%;
  87. background-color: #fff;
  88. z-index: 10;
  89. content: '';
  90. }
  91. &.full {
  92. margin: 0;
  93. }
  94. &.radius {
  95. border-radius: var(--radius);
  96. }
  97. &-gutter {
  98. margin-bottom: var(--gutter-v);
  99. }
  100. }
  101. </style>