chore: remove useless `fixedHeader` prop for `Page` (#5069)
							parent
							
								
									bac0275624
								
							
						
					
					
						commit
						373766691f
					
				|  | @ -26,7 +26,6 @@ outline: deep | ||||||
| | headerClass | 头部区域的class | `string` | - | - | | | headerClass | 头部区域的class | `string` | - | - | | ||||||
| | footerClass | 底部区域的class | `string` | - | - | | | footerClass | 底部区域的class | `string` | - | - | | ||||||
| | autoContentHeight | 自动调整内容区域的高度 | `boolean` | `false` | - | | | autoContentHeight | 自动调整内容区域的高度 | `boolean` | `false` | - | | ||||||
| | ~~fixedHeader~~ | ~~固定头部在页面内容区域顶部,在滚动时保持可见~~ | `boolean` | `false` | 待实现 | |  | ||||||
| 
 | 
 | ||||||
| ::: tip 注意 | ::: tip 注意 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,14 +1,7 @@ | ||||||
| <script setup lang="ts"> | <script setup lang="ts"> | ||||||
| import { | import { computed, nextTick, onMounted, ref, useTemplateRef } from 'vue'; | ||||||
|   computed, |  | ||||||
|   nextTick, |  | ||||||
|   onMounted, |  | ||||||
|   ref, |  | ||||||
|   type StyleValue, |  | ||||||
|   useTemplateRef, |  | ||||||
| } from 'vue'; |  | ||||||
| 
 | 
 | ||||||
| import { preferences } from '@vben-core/preferences'; | import { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT } from '@vben-core/shared/constants'; | ||||||
| import { cn } from '@vben-core/shared/utils'; | import { cn } from '@vben-core/shared/utils'; | ||||||
| 
 | 
 | ||||||
| interface Props { | interface Props { | ||||||
|  | @ -19,8 +12,6 @@ interface Props { | ||||||
|    * 根据content可见高度自适应 |    * 根据content可见高度自适应 | ||||||
|    */ |    */ | ||||||
|   autoContentHeight?: boolean; |   autoContentHeight?: boolean; | ||||||
|   /** 头部固定(暂未实现) */ |  | ||||||
|   fixedHeader?: boolean; |  | ||||||
|   headerClass?: string; |   headerClass?: string; | ||||||
|   footerClass?: string; |   footerClass?: string; | ||||||
| } | } | ||||||
|  | @ -29,13 +20,7 @@ defineOptions({ | ||||||
|   name: 'Page', |   name: 'Page', | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const { | const { autoContentHeight = false } = defineProps<Props>(); | ||||||
|   contentClass = '', |  | ||||||
|   description = '', |  | ||||||
|   autoContentHeight = false, |  | ||||||
|   title = '', |  | ||||||
|   fixedHeader = false, |  | ||||||
| } = defineProps<Props>(); |  | ||||||
| 
 | 
 | ||||||
| const headerHeight = ref(0); | const headerHeight = ref(0); | ||||||
| const footerHeight = ref(0); | const footerHeight = ref(0); | ||||||
|  | @ -44,22 +29,11 @@ const shouldAutoHeight = ref(false); | ||||||
| const headerRef = useTemplateRef<HTMLDivElement>('headerRef'); | const headerRef = useTemplateRef<HTMLDivElement>('headerRef'); | ||||||
| const footerRef = useTemplateRef<HTMLDivElement>('footerRef'); | const footerRef = useTemplateRef<HTMLDivElement>('footerRef'); | ||||||
| 
 | 
 | ||||||
| const headerStyle = computed<StyleValue>(() => { |  | ||||||
|   return fixedHeader |  | ||||||
|     ? { |  | ||||||
|         position: 'sticky', |  | ||||||
|         zIndex: 200, |  | ||||||
|         top: |  | ||||||
|           preferences.header.mode === 'fixed' ? 'var(--vben-header-height)' : 0, |  | ||||||
|       } |  | ||||||
|     : undefined; |  | ||||||
| }); |  | ||||||
| 
 |  | ||||||
| const contentStyle = computed(() => { | const contentStyle = computed(() => { | ||||||
|   if (autoContentHeight) { |   if (autoContentHeight) { | ||||||
|     return { |     return { | ||||||
|       height: shouldAutoHeight.value |       height: shouldAutoHeight.value | ||||||
|         ? `calc(var(--vben-content-height) - ${headerHeight.value}px - ${footerHeight.value}px)` |         ? `calc(var(${CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT}) - ${headerHeight.value}px)` | ||||||
|         : '0', |         : '0', | ||||||
|       // 'overflow-y': shouldAutoHeight.value?'auto':'unset', |       // 'overflow-y': shouldAutoHeight.value?'auto':'unset', | ||||||
|     }; |     }; | ||||||
|  | @ -97,15 +71,12 @@ onMounted(() => { | ||||||
|       ref="headerRef" |       ref="headerRef" | ||||||
|       :class=" |       :class=" | ||||||
|         cn( |         cn( | ||||||
|           'bg-card relative px-6 py-4', |           'bg-card border-border relative flex items-end border-b px-6 py-4', | ||||||
|           headerClass, |           headerClass, | ||||||
|           fixedHeader |  | ||||||
|             ? 'border-border border-b transition-all duration-200' |  | ||||||
|             : '', |  | ||||||
|         ) |         ) | ||||||
|       " |       " | ||||||
|       :style="headerStyle" |  | ||||||
|     > |     > | ||||||
|  |       <div class="flex-auto"> | ||||||
|         <slot name="title"> |         <slot name="title"> | ||||||
|           <div v-if="title" class="mb-2 flex text-lg font-semibold"> |           <div v-if="title" class="mb-2 flex text-lg font-semibold"> | ||||||
|             {{ title }} |             {{ title }} | ||||||
|  | @ -117,8 +88,9 @@ onMounted(() => { | ||||||
|             {{ description }} |             {{ description }} | ||||||
|           </p> |           </p> | ||||||
|         </slot> |         </slot> | ||||||
|  |       </div> | ||||||
| 
 | 
 | ||||||
|       <div v-if="$slots.extra" class="absolute bottom-4 right-4"> |       <div v-if="$slots.extra"> | ||||||
|         <slot name="extra"></slot> |         <slot name="extra"></slot> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|  | @ -132,8 +104,8 @@ onMounted(() => { | ||||||
|       ref="footerRef" |       ref="footerRef" | ||||||
|       :class=" |       :class=" | ||||||
|         cn( |         cn( | ||||||
|           footerClass, |  | ||||||
|           'bg-card align-center absolute bottom-0 left-0 right-0 flex px-6 py-4', |           'bg-card align-center absolute bottom-0 left-0 right-0 flex px-6 py-4', | ||||||
|  |           footerClass, | ||||||
|         ) |         ) | ||||||
|       " |       " | ||||||
|     > |     > | ||||||
|  |  | ||||||
|  | @ -362,7 +362,6 @@ function handleSetFormValue() { | ||||||
|   <Page |   <Page | ||||||
|     content-class="flex flex-col gap-4" |     content-class="flex flex-col gap-4" | ||||||
|     description="表单组件基础示例,请注意,该页面用到的参数代码会添加一些简单注释,方便理解,请仔细查看。" |     description="表单组件基础示例,请注意,该页面用到的参数代码会添加一些简单注释,方便理解,请仔细查看。" | ||||||
|     fixed-header |  | ||||||
|     header-class="pb-0" |     header-class="pb-0" | ||||||
|     title="表单组件" |     title="表单组件" | ||||||
|   > |   > | ||||||
|  |  | ||||||
|  | @ -77,7 +77,6 @@ function openFormModal() { | ||||||
| <template> | <template> | ||||||
|   <Page |   <Page | ||||||
|     description="弹窗组件常用于在不离开当前页面的情况下,显示额外的信息、表单或操作提示,更多api请查看组件文档。" |     description="弹窗组件常用于在不离开当前页面的情况下,显示额外的信息、表单或操作提示,更多api请查看组件文档。" | ||||||
|     fixed-header |  | ||||||
|     title="弹窗组件示例" |     title="弹窗组件示例" | ||||||
|   > |   > | ||||||
|     <template #extra> |     <template #extra> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Netfan
						Netfan