code refactor

This commit is contained in:
MaysWind
2025-01-27 15:37:55 +08:00
parent 8c0a9062a2
commit fd3457af84
7 changed files with 15 additions and 23 deletions
+4 -4
View File
@@ -38,17 +38,17 @@ export function useHomePageBase() {
const netAssets = computed<string>(() => {
const netAssets = accountsStore.getNetAssets(showAmountInHomePage.value);
return formatAmountWithCurrency(netAssets, defaultCurrency.value) as string;
return formatAmountWithCurrency(netAssets, defaultCurrency.value);
});
const totalAssets = computed<string>(() => {
const totalAssets = accountsStore.getTotalAssets(showAmountInHomePage.value);
return formatAmountWithCurrency(totalAssets, defaultCurrency.value) as string;
return formatAmountWithCurrency(totalAssets, defaultCurrency.value);
});
const totalLiabilities = computed<string>(() => {
const totalLiabilities = accountsStore.getTotalLiabilities(showAmountInHomePage.value);
return formatAmountWithCurrency(totalLiabilities, defaultCurrency.value) as string;
return formatAmountWithCurrency(totalLiabilities, defaultCurrency.value);
});
const displayDateRange = computed<TransactionOverviewDisplayTime>(() => {
@@ -75,7 +75,7 @@ export function useHomePageBase() {
function getDisplayAmount(amount: number, incomplete: boolean): string {
if (!showAmountInHomePage.value) {
return formatAmountWithCurrency('***', defaultCurrency.value) as string;
return formatAmountWithCurrency('***', defaultCurrency.value);
}
return formatAmountWithCurrency(amount, defaultCurrency.value) + (incomplete ? '+' : '');
@@ -191,7 +191,7 @@ export function useStatisticsTransactionPageBase() {
const trendsAnalysisData = computed<TransactionTrendsAnalysisData | null>(() => statisticsStore.trendsAnalysisData);
function getDisplayAmount(amount: number, currency: string, textLimit?: number): string {
const finalAmount = formatAmountWithCurrency(amount, currency) as string;
const finalAmount = formatAmountWithCurrency(amount, currency);
if (!showAccountBalance.value
&& (query.value.chartDataType === ChartDataType.AccountTotalAssets.type