40 lines
1001 B
Vue
40 lines
1001 B
Vue
<template>
|
|
<scroll-view
|
|
class="page-scroll-view"
|
|
scroll-y
|
|
:style="mergedStyle"
|
|
v-bind="$attrs"
|
|
>
|
|
<slot />
|
|
</scroll-view>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type { CSSProperties } from 'vue'
|
|
import { computed } from 'vue'
|
|
import { usePageScrollHeight } from '@/hooks/use-page-scroll-height'
|
|
|
|
defineOptions({ inheritAttrs: false })
|
|
|
|
const props = defineProps<{
|
|
/** 外部传入时覆盖内部计算(如设备详情页自定义顶部区域) */
|
|
scrollStyle?: CSSProperties
|
|
extraBottomPx?: number
|
|
/** 页面顶部固定区域选择器(导航栏 + 步骤条等),用于计算滚动区高度 */
|
|
topSelector?: string
|
|
}>()
|
|
|
|
const { scrollStyle: defaultScrollStyle } = usePageScrollHeight({
|
|
extraBottomPx: props.extraBottomPx ?? 0,
|
|
topSelector: props.topSelector,
|
|
})
|
|
|
|
const mergedStyle = computed<CSSProperties>(() => props.scrollStyle ?? defaultScrollStyle.value)
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.page-scroll-view {
|
|
flex-shrink: 0;
|
|
}
|
|
</style>
|