mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
use for-of statements to replace for and for-in
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
<span class="numpad-button-text numpad-button-text-normal">{{ decimalSeparator }}</span>
|
||||
</f7-button>
|
||||
<f7-button class="numpad-button numpad-button-num" v-if="!supportDecimalSeparator" @click="inputDoubleNum(0)">
|
||||
<span class="numpad-button-text numpad-button-text-normal">{{ digits[0] + digits[0] }}</span>
|
||||
<span class="numpad-button-text numpad-button-text-normal">{{ `${digits[0]}${digits[0]}` }}</span>
|
||||
</f7-button>
|
||||
<f7-button class="numpad-button numpad-button-num" @click="inputNum(0)">
|
||||
<span class="numpad-button-text numpad-button-text-normal">{{ digits[0] }}</span>
|
||||
@@ -114,11 +114,11 @@ const digits = computed<string[]>(() => getAllLocalizedDigits());
|
||||
const decimalSeparator = computed<string>(() => getCurrentDecimalSeparator());
|
||||
|
||||
const supportDecimalSeparator = computed<boolean>(() => {
|
||||
if (!props.currency || !ALL_CURRENCIES[props.currency] || !isNumber(ALL_CURRENCIES[props.currency].fraction)) {
|
||||
if (!props.currency || !ALL_CURRENCIES[props.currency] || !isNumber(ALL_CURRENCIES[props.currency]!.fraction)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (ALL_CURRENCIES[props.currency].fraction as number) > 0;
|
||||
return (ALL_CURRENCIES[props.currency]!.fraction as number) > 0;
|
||||
});
|
||||
|
||||
const currentDisplay = computed<string>(() => {
|
||||
|
||||
@@ -105,8 +105,8 @@ const circumference: number = diameter * Math.PI;
|
||||
const totalValidValue = computed<number>(() => {
|
||||
let totalValidValue = 0;
|
||||
|
||||
for (let i = 0; i < validItems.value.length; i++) {
|
||||
totalValidValue += validItems.value[i].value;
|
||||
for (const item of validItems.value) {
|
||||
totalValidValue += item.value;
|
||||
}
|
||||
|
||||
return totalValidValue;
|
||||
@@ -120,7 +120,7 @@ const itemCommonDashOffset = computed<number>(() => {
|
||||
let offset = 0;
|
||||
|
||||
for (let i = 0; i < Math.min(selectedIndex.value + 1, validItems.value.length); i++) {
|
||||
const item = validItems.value[i];
|
||||
const item = validItems.value[i] as CommonPieChartDataItem;
|
||||
|
||||
if (item.actualPercent > 0) {
|
||||
if (i === selectedIndex.value) {
|
||||
@@ -154,9 +154,7 @@ function getItemStrokeDash(item: CommonPieChartDataItem): string {
|
||||
function getItemDashOffset(item: CommonPieChartDataItem, items: CommonPieChartDataItem[], offset?: number): number {
|
||||
let allPreviousPercent = 0;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const curItem = items[i];
|
||||
|
||||
for (const curItem of items) {
|
||||
if (curItem === item) {
|
||||
break;
|
||||
}
|
||||
@@ -189,7 +187,7 @@ const selectedItem = computed<CommonPieChartDataItem | null>(() => {
|
||||
index = 0;
|
||||
}
|
||||
|
||||
return validItems.value[index];
|
||||
return validItems.value[index] ?? null;
|
||||
});
|
||||
|
||||
function switchSelectedIndex(index: number): void {
|
||||
|
||||
Reference in New Issue
Block a user