blob: 6c01f94377017bf3470b92122b603f2d3009cf30 [file] [log] [blame]
guangchao.xu070005a2020-12-07 09:56:40 +08001<template>
2 <view class="u-gap" :style="[gapStyle]"></view>
3</template>
4
5<script>
6/**
7 * gap 间隔槽
8 * @description 该组件一般用于内容块之间的用一个灰色块隔开的场景,方便用户风格统一,减少工作量
9 * @tutorial https://www.uviewui.com/components/gap.html
10 * @property {String} bg-color 背景颜色(默认#f3f4f6)
11 * @property {String Number} height 分割槽高度,单位rpx(默认30)
12 * @property {String Number} margin-top 与前一个组件的距离,单位rpx(默认0)
13 * @property {String Number} margin-bottom 与后一个组件的距离,单位rpx(0)
14 * @example <u-gap height="80" bg-color="#bbb"></u-gap>
15 */
16export default {
17 name: "u-gap",
18 props: {
19 bgColor: {
20 type: String,
21 default: 'transparent ' // 背景透明
22 },
23 // 高度
24 height: {
25 type: [String, Number],
26 default: 30
27 },
28 // 与上一个组件的距离
29 marginTop: {
30 type: [String, Number],
31 default: 0
32 },
33 // 与下一个组件的距离
34 marginBottom: {
35 type: [String, Number],
36 default: 0
37 },
38 },
39 computed: {
40 gapStyle() {
41 return {
42 backgroundColor: this.bgColor,
43 height: this.height + 'rpx',
44 marginTop: this.marginTop + 'rpx',
45 marginBottom: this.marginBottom + 'rpx'
46 };
47 }
48 }
49};
50</script>
51
52<style lang="scss" scoped>
53 @import "../../libs/css/style.components.scss";
54</style>