推广小程序前端代码
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.

63 lines
1.9 KiB

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