index.vue 744 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div class="m-card" :class="shadowClass">
  3. <div class="m-card__header" v-if="$slots.header || header">
  4. <slot name="header">{{ header }}</slot>
  5. </div>
  6. <div class="m-card__body" :style="bodyStyle">
  7. <slot></slot>
  8. </div>
  9. </div>
  10. </template>
  11. <script>
  12. export default {
  13. name: "mCard"
  14. };
  15. </script>
  16. <script setup>
  17. import { computed } from 'vue-demi';
  18. const props = defineProps({
  19. header: {
  20. type: String,
  21. default: '',
  22. },
  23. bodyStyle: Object,
  24. shadow: {
  25. type: String,
  26. default: 'always'
  27. }
  28. })
  29. const shadowClass = computed(() => {
  30. return {
  31. [`is-shadow-${props.shadow}`]: props.shadow
  32. }
  33. })
  34. </script>
  35. <style lang="scss" scoped>
  36. @import '../../styles/components/card.scss';
  37. </style>