Skip to content

Commit

Permalink
feat: 增加pi-gap间隔槽插件
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhenfei committed Sep 23, 2020
1 parent d995337 commit 22ab4fe
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
66 changes: 66 additions & 0 deletions components/pi-gap/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<template>
<view class="pi-gap" :style="[gapStyle]">
<slot />
</view>
</template>

<script>
/**
* 间隔槽
*/
import { getConfig } from '../../config'
const { gap } = getConfig()
const TAG = 'PiGap'
export default {
name: TAG,
props: {
// 自定义样式,对象形式(默认值:{})
customStyle: {
type: Object,
default() {
return gap.customStyle
}
},
// 自定义样式类,字符串形式('')
customClass: {
type: String,
default() {
return gap.customClass
}
},
// 背景颜色(默认透明)
background: {
required: false,
type: String,
default: gap.background
},
// 高度
height: {
type: [String, Number],
default: gap.height
},
// 与上一个组件的距离
marginTop: {
type: [String, Number],
default: gap.marginTop
},
// 与下一个组件的距离
marginBottom: {
type: [String, Number],
default: gap.marginBottom
}
},
computed: {
gapStyle() {
return {
backgroundColor: this.background,
height: this.$pi.common.addUnit(this.height),
marginTop: this.$pi.common.addUnit(this.marginTop),
marginBottom: this.$pi.common.addUnit(this.marginBottom)
}
}
}
}
</script>
2 changes: 0 additions & 2 deletions components/pi-line-progress/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
/**
* 线型进度条
*/
import { systemInfo } from '../../tools/system'
import { getConfig } from '../../config'
const { lineProgress } = getConfig()
Expand Down
8 changes: 8 additions & 0 deletions config/gap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
customClass: '', // 自定义样式类,字符串形式('')
customStyle: {}, // 自定义样式,对象形式(默认值:{})
background: '#F4F4F4', // 背景颜色
height: 24, // 高度
marginTop: 0, // 顶部间距
marginBottom: 0 // 底部间距
}

0 comments on commit 22ab4fe

Please sign in to comment.