ContentDetailWrap.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <script lang="ts" setup>
  2. import { propTypes } from '@/utils/propTypes'
  3. import { useDesign } from '@/hooks/web/useDesign'
  4. defineOptions({ name: 'ContentDetailWrap' })
  5. const { t } = useI18n()
  6. const { getPrefixCls } = useDesign()
  7. const prefixCls = getPrefixCls('content-detail-wrap')
  8. defineProps({
  9. title: propTypes.string.def(''),
  10. message: propTypes.string.def('')
  11. })
  12. const emit = defineEmits(['back'])
  13. const offset = ref(85)
  14. const contentDetailWrap = ref()
  15. onMounted(() => {
  16. offset.value = contentDetailWrap.value.getBoundingClientRect().top
  17. })
  18. </script>
  19. <template>
  20. <div ref="contentDetailWrap" :class="[`${prefixCls}-container`]">
  21. <Sticky :offset="offset">
  22. <div
  23. :class="[
  24. `${prefixCls}-header`,
  25. 'flex b-b-1 h-50px items-center text-center bg-white pr-10px'
  26. ]"
  27. >
  28. <div :class="[`${prefixCls}-header__back`, 'flex pl-10px pr-10px ']">
  29. <ElButton @click="emit('back')">
  30. <Icon class="mr-5px" icon="ep:arrow-left" />
  31. {{ t('common.back') }}
  32. </ElButton>
  33. </div>
  34. <div :class="[`${prefixCls}-header__title`, 'flex flex-1 justify-center']">
  35. <slot name="title">
  36. <label class="text-16px font-700">{{ title }}</label>
  37. </slot>
  38. </div>
  39. <div :class="[`${prefixCls}-header__right`, 'flex pl-10px pr-10px']">
  40. <slot name="right"></slot>
  41. </div>
  42. </div>
  43. </Sticky>
  44. <div style="padding: var(--app-content-padding)">
  45. <ElCard :class="[`${prefixCls}-body`, 'mb-20px']" shadow="never">
  46. <div>
  47. <slot></slot>
  48. </div>
  49. </ElCard>
  50. </div>
  51. </div>
  52. </template>