You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.9 KiB

5 months ago
  1. <template>
  2. <view :style="[addStyle(customStyle)]" :class="[customClass]" class="u-cell-group">
  3. <view v-if="title" class="u-cell-group__title">
  4. <slot name="title">
  5. <text class="u-cell-group__title__text">{{ title }}</text>
  6. </slot>
  7. </view>
  8. <view class="u-cell-group__wrapper">
  9. <u-line v-if="border"></u-line>
  10. <slot />
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import { props } from './props';
  16. import { mpMixin } from '../../libs/mixin/mpMixin';
  17. import { mixin } from '../../libs/mixin/mixin';
  18. import { addStyle } from '../../libs/function/index';
  19. /**
  20. * cellGroup 单元格
  21. * @description cell单元格一般用于一组列表的情况比如个人中心页设置页等
  22. * @tutorial https://uview-plus.jiangruyi.com/components/cell.html
  23. *
  24. * @property {String} title 分组标题
  25. * @property {Boolean} border 是否显示外边框 (默认 true )
  26. * @property {Object} customStyle 定义需要用到的外部样式
  27. *
  28. * @event {Function} click 点击cell列表时触发
  29. * @example <u-cell-group title="设置喜好">
  30. */
  31. export default {
  32. name: 'u-cell-group',
  33. mixins: [mpMixin, mixin, props],
  34. methods: {
  35. addStyle
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. @import "../../libs/css/components.scss";
  41. $u-cell-group-title-padding: 16px 16px 8px !default;
  42. $u-cell-group-title-font-size: 15px !default;
  43. $u-cell-group-title-line-height: 16px !default;
  44. $u-cell-group-title-color: $u-main-color !default;
  45. .u-cell-group {
  46. flex: 1;
  47. &__title {
  48. padding: $u-cell-group-title-padding;
  49. &__text {
  50. font-size: $u-cell-group-title-font-size;
  51. line-height: $u-cell-group-title-line-height;
  52. color: $u-cell-group-title-color;
  53. }
  54. }
  55. &__wrapper {
  56. position: relative;
  57. }
  58. }
  59. </style>