mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 15:37:33 +08:00
use for-of statements to replace for and for-in
This commit is contained in:
@@ -40,11 +40,13 @@ export function useNumberInputBase(props: NumberInputProps, emit: NumberInputEmi
|
||||
|
||||
let finalValue = '';
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (!NumeralSystem.WesternArabicNumerals.isDigit(value[i]) && !numeralSystem.value.isDigit(value[i]) && value[i] !== '-' && value[i] !== decimalSeparator) {
|
||||
const ch = value.charAt(i);
|
||||
|
||||
if (!NumeralSystem.WesternArabicNumerals.isDigit(ch) && !numeralSystem.value.isDigit(ch) && ch !== '-' && ch !== decimalSeparator) {
|
||||
break;
|
||||
}
|
||||
|
||||
finalValue += value[i];
|
||||
finalValue += ch;
|
||||
}
|
||||
|
||||
finalValue = numeralSystem.value.replaceLocalizedDigitsToWesternArabicDigits(finalValue);
|
||||
@@ -104,14 +106,16 @@ export function useNumberInputBase(props: NumberInputProps, emit: NumberInputEmi
|
||||
const decimalSeparator = getCurrentDecimalSeparator();
|
||||
|
||||
if (newValue[0] === '-' || newValue[0] === decimalSeparator) {
|
||||
actualNumeralSystem = NumeralSystem.detect(newValue[1]);
|
||||
actualNumeralSystem = NumeralSystem.detect(newValue.charAt(1));
|
||||
} else {
|
||||
actualNumeralSystem = NumeralSystem.detect(newValue[0]);
|
||||
actualNumeralSystem = NumeralSystem.detect(newValue.charAt(0));
|
||||
}
|
||||
|
||||
if (actualNumeralSystem && (actualNumeralSystem.type === NumeralSystem.WesternArabicNumerals.type || actualNumeralSystem.type === numeralSystem.value.type)) {
|
||||
for (let i = 0; i < newValue.length; i++) {
|
||||
if (!NumeralSystem.WesternArabicNumerals.isDigit(newValue[i]) && !numeralSystem.value.isDigit(newValue[i]) && newValue[i] !== '-' && newValue[i] !== decimalSeparator) {
|
||||
const ch = newValue.charAt(i);
|
||||
|
||||
if (!NumeralSystem.WesternArabicNumerals.isDigit(ch) && !numeralSystem.value.isDigit(ch) && ch !== '-' && ch !== decimalSeparator) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,7 @@ export function usePieChartBase(props: CommonPieChartProps) {
|
||||
const validItems = computed<CommonPieChartDataItem[]>(() => {
|
||||
let totalValidValue = 0;
|
||||
|
||||
for (let i = 0; i < props.items.length; i++) {
|
||||
const item = props.items[i];
|
||||
for (const item of props.items) {
|
||||
const value = item[props.valueField];
|
||||
|
||||
if (isNumber(value) && value > 0 && (!props.hiddenField || !item[props.hiddenField])) {
|
||||
@@ -55,8 +54,7 @@ export function usePieChartBase(props: CommonPieChartProps) {
|
||||
|
||||
const validItems: CommonPieChartDataItem[] = [];
|
||||
|
||||
for (let i = 0; i < props.items.length; i++) {
|
||||
const item = props.items[i];
|
||||
for (const item of props.items) {
|
||||
const value = item[props.valueField];
|
||||
const percent = props.percentField ? item[props.percentField] : -1;
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ export function useScheduleFrequencySelectionBase() {
|
||||
const values = value.split(',');
|
||||
const ret: number[] = [];
|
||||
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (values[i]) {
|
||||
ret.push(parseInt(values[i]));
|
||||
for (const value of values) {
|
||||
if (value) {
|
||||
ret.push(parseInt(value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user