commit | author | age
|
e3ba12
|
1 |
<template> |
Z |
2 |
<view class="u-gap" :style="[gapStyle]"></view> |
|
3 |
</template> |
|
4 |
|
|
5 |
<script> |
|
6 |
import props from './props.js'; |
|
7 |
/** |
|
8 |
* gap 间隔槽 |
|
9 |
* @description 该组件一般用于内容块之间的用一个灰色块隔开的场景,方便用户风格统一,减少工作量 |
|
10 |
* @tutorial https://www.uviewui.com/components/gap.html |
|
11 |
* @property {String} bgColor 背景颜色 (默认 'transparent' ) |
|
12 |
* @property {String | Number} height 分割槽高度,单位px (默认 20 ) |
|
13 |
* @property {String | Number} marginTop 与前一个组件的距离,单位px( 默认 0 ) |
|
14 |
* @property {String | Number} marginBottom 与后一个组件的距离,单位px (默认 0 ) |
|
15 |
* @property {Object} customStyle 定义需要用到的外部样式 |
|
16 |
* |
|
17 |
* @example <u-gap height="80" bg-color="#bbb"></u-gap> |
|
18 |
*/ |
|
19 |
export default { |
|
20 |
name: "u-gap", |
|
21 |
mixins: [uni.$u.mpMixin, uni.$u.mixin,props], |
|
22 |
computed: { |
|
23 |
gapStyle() { |
|
24 |
const style = { |
|
25 |
backgroundColor: this.bgColor, |
|
26 |
height: uni.$u.addUnit(this.height), |
|
27 |
marginTop: uni.$u.addUnit(this.marginTop), |
|
28 |
marginBottom: uni.$u.addUnit(this.marginBottom), |
|
29 |
} |
|
30 |
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)) |
|
31 |
} |
|
32 |
} |
|
33 |
}; |
|
34 |
</script> |
|
35 |
|
|
36 |
<style lang="scss" scoped> |
|
37 |
@import "../../libs/css/components.scss"; |
|
38 |
</style> |