2
0

fix:首页仪表盘中英显示和充值联动

This commit is contained in:
zhongzm
2024-12-06 09:45:50 +08:00
parent 2974f4ff63
commit b5a5aa3afd
2 changed files with 48 additions and 13 deletions

View File

@@ -0,0 +1,27 @@
import { defineStore } from 'pinia';
interface BillingState {
balance: number;
usedAmount: number;
}
export const useBillingStore = defineStore('billing', {
state: (): BillingState => ({
balance: 23,
usedAmount: 77,
}),
actions: {
updateBalance(newBalance: number) {
this.balance = Number(newBalance.toFixed(2));
},
updateUsedAmount(newUsedAmount: number) {
this.usedAmount = Number(newUsedAmount.toFixed(2));
}
},
getters: {
getBalance: (state): number => state.balance,
getUsedAmount: (state): number => state.usedAmount
}
});