fs-row.vue 690 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <view class="fs-row" :style="{ marginLeft: margin, marginRight: margin }"><slot></slot></view>
  3. </template>
  4. <script>
  5. /**
  6. * 栅格布局组件
  7. * @description 栅格布局组件
  8. * @property {Number,String} gutter 间距(单位rpx)
  9. */
  10. export default {
  11. name: 'fs-row'
  12. }
  13. </script>
  14. <script setup>
  15. import { computed, toRefs, provide } from 'vue'
  16. const props = defineProps({
  17. gutter: {
  18. type: [Number, String],
  19. default: 0
  20. }
  21. })
  22. const margin = computed(() => `${parseInt(props.gutter) / -2}rpx`)
  23. provide('rowGap', props.gutter)
  24. </script>
  25. <style lang="scss" scoped>
  26. .fs-row::after {
  27. content: '';
  28. display: table;
  29. clear: both;
  30. }
  31. </style>