fs-card.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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" :style="titleStyle">
  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. titleStyle: {
  21. type: Object,
  22. default() {
  23. return {}
  24. }
  25. },
  26. full: Boolean,
  27. gutter: Boolean,
  28. radius: {
  29. type: Boolean,
  30. default: true
  31. },
  32. shadow: {
  33. type: Boolean,
  34. default: false
  35. },
  36. })
  37. const slots = useSlots()
  38. </script>
  39. <style lang="scss" scoped>
  40. .fs-card{
  41. margin-left: var(--gutter);
  42. margin-right: var(--gutter);
  43. &-box{
  44. background-color: #fff;
  45. overflow: hidden;
  46. }
  47. &-radius{
  48. border-radius: var(--radius);
  49. }
  50. &-title{
  51. padding: 20rpx var(--gutter);
  52. border-bottom: 2rpx solid var(--border-color);
  53. }
  54. &-ft{
  55. padding: 20rpx var(--gutter);
  56. border-top: 2rpx solid var(--border-color);
  57. }
  58. &-full{
  59. margin-left: 0;
  60. margin-right: 0;
  61. }
  62. &-gutter{
  63. margin-bottom: var(--gutter-v);
  64. }
  65. }
  66. </style>