mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 09:14:27 +08:00
use for-of statements to replace for and for-in
This commit is contained in:
@@ -78,9 +78,7 @@ const hasAnyData = computed<boolean>(() => {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < props.data.length; i++) {
|
||||
const item = props.data[i];
|
||||
|
||||
for (const item of props.data) {
|
||||
if (item.incomeAmount > 0 || item.incomeAmount < 0 || item.expenseAmount > 0 || item.expenseAmount < 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -99,8 +97,7 @@ const chartOptions = computed<object>(() => {
|
||||
const expenseIncomeAmountColor = getExpenseAndIncomeAmountColor(userStore.currentUserExpenseAmountColor, userStore.currentUserIncomeAmountColor, props.isDarkMode);
|
||||
|
||||
if (props.data) {
|
||||
for (let i = 0; i < props.data.length; i++) {
|
||||
const item = props.data[i];
|
||||
for (const item of props.data) {
|
||||
const monthShortName = formatUnixTimeToGregorianLikeShortMonth(item.monthStartTime);
|
||||
|
||||
monthNames.push(monthShortName);
|
||||
@@ -145,10 +142,9 @@ const chartOptions = computed<object>(() => {
|
||||
let incomeAmount: string | null = null;
|
||||
let expenseAmount: string | null = null;
|
||||
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
const param = params[i];
|
||||
for (const param of params) {
|
||||
const dataIndex = param.dataIndex;
|
||||
const data = props.data[dataIndex];
|
||||
const data = props.data[dataIndex] as TransactionMonthlyIncomeAndExpenseData;
|
||||
|
||||
if (param.seriesId === 'seriesIncome') {
|
||||
incomeAmount = getDisplayIncomeAmount(data);
|
||||
@@ -160,7 +156,7 @@ const chartOptions = computed<object>(() => {
|
||||
return `<table>` +
|
||||
`<thead>` +
|
||||
`<tr>` +
|
||||
`<td colspan="2" class="text-start">${params[0].name}</td>` +
|
||||
`<td colspan="2" class="text-start">${params[0]?.name}</td>` +
|
||||
`</tr>` +
|
||||
`</thead>` +
|
||||
`<tbody>` +
|
||||
|
||||
Reference in New Issue
Block a user