fs-panel.vue 997 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <view class="fs-panel">
  3. <view class="fs-panel-title">
  4. <view v-if="title">{{ title }}</view>
  5. <view v-else><slot name="title"></slot></view>
  6. </view>
  7. <view class="fs-panel-content" :class="{ 'fs-panel-padding': padding }" :style="{ 'background-color': bgColor }">
  8. <slot name="content"></slot>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. /**
  14. * 面板组件
  15. * @description 面板组件
  16. * @property {String} title 标题
  17. * @property {Boolean} padding 内容区域是否带padding
  18. * @property {String} bgColor 内容区域背景色
  19. */
  20. export default {
  21. name: 'fs-panel'
  22. }
  23. </script>
  24. <script setup>
  25. const props = defineProps({
  26. title: String,
  27. padding: Boolean,
  28. bgColor: {
  29. type: String,
  30. default: '#fff'
  31. }
  32. })
  33. </script>
  34. <style lang="scss">
  35. .fs-panel-title {
  36. padding: 20rpx var(--gutter);
  37. color: var(--title);
  38. text-align: left;
  39. background-color: var(--bg-color);
  40. }
  41. .fs-panel-padding {
  42. padding: var(--gutter);
  43. }
  44. </style>