fs-card.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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': contentPadding}">
  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. contentPadding: Boolean,
  37. })
  38. const slots = useSlots()
  39. </script>
  40. <style lang="scss" scoped>
  41. .fs-card{
  42. margin-left: var(--gutter);
  43. margin-right: var(--gutter);
  44. &-box{
  45. background-color: #fff;
  46. overflow: hidden;
  47. }
  48. &-radius{
  49. border-radius: var(--radius);
  50. }
  51. &-title{
  52. padding: 20rpx var(--gutter);
  53. border-bottom: 2rpx solid var(--border-color);
  54. }
  55. &-ft{
  56. padding: 20rpx var(--gutter);
  57. border-top: 2rpx solid var(--border-color);
  58. }
  59. &-content{
  60. padding: 20rpx var(--gutter);
  61. }
  62. &-full{
  63. margin-left: 0;
  64. margin-right: 0;
  65. }
  66. &-gutter{
  67. margin-bottom: var(--gutter-v);
  68. }
  69. }
  70. </style>