use for-of statements to replace for and for-in

This commit is contained in:
MaysWind
2025-09-09 23:48:42 +08:00
parent c75a902d84
commit 34c5a1750e
50 changed files with 368 additions and 460 deletions
+4 -3
View File
@@ -48,6 +48,7 @@ import { computed } from 'vue';
import { useI18n } from '@/locales/helpers.ts';
import { itemAndIndex } from '@/core/base.ts';
import { NumeralSystem } from '@/core/numeral.ts';
export interface StepBarItem {
@@ -87,9 +88,9 @@ function isStepActive(step: StepBarItem): boolean {
}
function isStepCompleted(stepIndex: number): boolean {
for (let i = 0; i < props.steps.length; i++) {
if (props.steps[i].name === props.currentStep) {
return stepIndex < i;
for (const [step, index] of itemAndIndex(props.steps)) {
if (step.name === props.currentStep) {
return stepIndex < index;
}
}