fs-card.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="fs-card" :class="{'fs-card-full': full, 'fs-card-gutter': gutter}">
  3. <view class="fs-card-box" :class="{'fs-card-radius': radius, shadow}">
  4. <view class="fs-card-title" v-if="slots.title || title">
  5. <slot name="title">{{title}}</slot>
  6. </view>
  7. <view class="fs-card-content">
  8. <slot></slot>
  9. </view>
  10. <view class="fs-card-ft" v-if="slots.footer">
  11. <slot name="footer"></slot>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import { useSlots } from 'vue'
  18. const props = defineProps({
  19. title: String,
  20. full: Boolean,
  21. gutter: Boolean,
  22. radius: {
  23. type: Boolean,
  24. default: true
  25. },
  26. shadow: {
  27. type: Boolean,
  28. default: false
  29. },
  30. })
  31. const slots = useSlots()
  32. </script>
  33. <style lang="scss" scoped>
  34. .fs-card{
  35. margin-left: var(--gutter);
  36. margin-right: var(--gutter);
  37. &-box{
  38. background-color: #fff;
  39. overflow: hidden;
  40. }
  41. &-radius{
  42. border-radius: var(--radius);
  43. }
  44. &-title{
  45. padding: 20rpx var(--gutter);
  46. border-bottom: 2rpx solid var(--border-color);
  47. }
  48. &-ft{
  49. padding: 20rpx var(--gutter);
  50. border-top: 2rpx solid var(--border-color);
  51. }
  52. &-full{
  53. margin-left: 0;
  54. margin-right: 0;
  55. }
  56. &-gutter{
  57. margin-bottom: var(--gutter-v);
  58. }
  59. }
  60. </style>