Blame view

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