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