铝交易,微信公众号
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.3 KiB

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