hookehuyr

feat(首页): 流程步骤少于7个时平均分布

当只有一屏且步骤数少于7个时,使用 space-evenly 让步骤平均分布到整个屏幕宽度,而不是用占位符填充。

- 新增 shouldDistributeEvenly 计算属性判断是否需要平均分布
- 模板绑定动态 class 实现样式切换
- 添加 distribute-evenly 样式类

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
47 <!-- 单页步骤容器:宽度占满一屏,Scroll Snap对齐 --> 47 <!-- 单页步骤容器:宽度占满一屏,Scroll Snap对齐 -->
48 <div 48 <div
49 class="process-steps" 49 class="process-steps"
50 + :class="{ 'distribute-evenly': shouldDistributeEvenly }"
50 v-for="(page, pindex) in stepPages" 51 v-for="(page, pindex) in stepPages"
51 :key="pindex" 52 :key="pindex"
52 > 53 >
...@@ -275,6 +276,17 @@ const stepPages = computed(() => { ...@@ -275,6 +276,17 @@ const stepPages = computed(() => {
275 return pages 276 return pages
276 }) 277 })
277 278
279 +/**
280 + * 是否应该平均分布步骤
281 + * 说明:当只有一屏且步骤数少于7个时,让步骤平均分布到整个屏幕宽度
282 + * @returns {boolean} 是否平均分布
283 + */
284 +const shouldDistributeEvenly = computed(() => {
285 + const totalSteps = processSteps.value.length
286 + const totalPages = stepPages.value.length
287 + return totalPages === 1 && totalSteps < steps_per_page
288 +})
289 +
278 // 获取当前选中的步骤 290 // 获取当前选中的步骤
279 const currentStep = computed(() => { 291 const currentStep = computed(() => {
280 return processSteps.value.find(step => step.active) || processSteps.value[0] 292 return processSteps.value.find(step => step.active) || processSteps.value[0]
...@@ -1151,6 +1163,16 @@ const handlePhotoClick = () => { ...@@ -1151,6 +1163,16 @@ const handlePhotoClick = () => {
1151 gap: 0.5rem; 1163 gap: 0.5rem;
1152 } 1164 }
1153 1165
1166 +/* 平均分布模式:当只有一屏且步骤数少于7个时 */
1167 +.process-steps.distribute-evenly {
1168 + justify-content: space-evenly;
1169 +}
1170 +
1171 +/* 平均分布时隐藏占位符,不占据空间 */
1172 +.process-steps.distribute-evenly .process-step.placeholder {
1173 + display: none;
1174 +}
1175 +
1154 /* 流程步骤分页容器:横向滚动,每屏一页 */ 1176 /* 流程步骤分页容器:横向滚动,每屏一页 */
1155 .process-steps-wrapper { 1177 .process-steps-wrapper {
1156 position: relative; 1178 position: relative;
......