u-cell-group.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="u-cell-box">
  3. <view class="u-cell-title" v-if="title" :style="[titleStyle]">{{ title }}</view>
  4. <view class="u-cell-item-box" :class="{ 'u-border-bottom u-border-top': border }">
  5. <slot />
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. /**
  11. * cellGroup 单元格父组件Group
  12. * @description cell单元格一般用于一组列表的情况,比如个人中心页,设置页等。搭配u-cell-item
  13. * @tutorial https://www.uviewui.com/components/cell.html
  14. * @property {String} title 分组标题
  15. * @property {Boolean} border 是否显示外边框(默认true)
  16. * @property {Object} title-style 分组标题的的样式,对象形式,如{'font-size': '24rpx'} 或 {'fontSize': '24rpx'}
  17. * @example <u-cell-group title="设置喜好">
  18. */
  19. export default {
  20. name: "u-cell-group",
  21. props: {
  22. // 分组标题
  23. title: {
  24. type: String,
  25. default: ''
  26. },
  27. // 是否显示分组list上下边框
  28. border: {
  29. type: Boolean,
  30. default: true
  31. },
  32. // 分组标题的样式,对象形式,注意驼峰属性写法
  33. // 类似 {'font-size': '24rpx'} 和 {'fontSize': '24rpx'}
  34. titleStyle: {
  35. type: Object,
  36. default() {
  37. return {};
  38. }
  39. }
  40. },
  41. data() {
  42. return {
  43. index: 0,
  44. }
  45. },
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. @import "../../libs/css/style.components.scss";
  50. .u-cell-box {
  51. width: 100%;
  52. }
  53. // .u-cell-title {
  54. // padding: 30rpx 32rpx 10rpx 32rpx;
  55. // font-size: 30rpx;
  56. // text-align: left;
  57. // color: $u-tips-color;
  58. // }
  59. .u-cell-title {
  60. font-size: 28rpx;
  61. font-weight: 700;
  62. padding: 30rpx 32rpx 10rpx 50rpx;
  63. position: relative;
  64. &::before {
  65. background-color: #0974C5;
  66. content: "";
  67. position: absolute;
  68. border-radius: 4rpx;
  69. top: 48rpx;
  70. left: 30rpx;
  71. -webkit-transform: translateY(-50%);
  72. transform: translateY(-50%);
  73. width: 4px;
  74. height: 15px;
  75. }
  76. }
  77. .u-cell-item-box {
  78. // background-color: #FFFFFF;
  79. }
  80. </style>