DemoBlock.vue 847 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <script setup lang="ts">
  2. import Text from '../basic/Text.vue';
  3. import DemoTitle from './DemoTitle.vue';
  4. defineProps({
  5. title: String,
  6. desc: String,
  7. flat: Boolean,
  8. smallTitle: Boolean,
  9. })
  10. </script>
  11. <template>
  12. <view :class="['nana-demo-block',flat?'flat':'']">
  13. <view class="header">
  14. <DemoTitle v-if="title" :title="title" :desc="desc" :small="smallTitle" />
  15. <Text v-if="desc" color="text.second" :text="desc" />
  16. </view>
  17. <slot />
  18. </view>
  19. </template>
  20. <style>
  21. .nana-demo-block {
  22. position: relative;
  23. display: flex;
  24. flex-direction: column;
  25. margin: 0 40rpx 40rpx 40rpx;
  26. }
  27. .nana-demo-block.flat {
  28. padding: 0;
  29. margin: 0;
  30. margin-bottom: 40rpx;
  31. background-color: transparent;
  32. }
  33. .nana-demo-block.flat .header {
  34. margin: 0 40rpx 20rpx 40rpx;
  35. }
  36. .nana-demo-block .header {
  37. margin: 0 0 20rpx 0;
  38. }
  39. </style>