fix:首页仪表盘中英显示和充值联动
This commit is contained in:
27
src/store/modules/billing/billing.ts
Normal file
27
src/store/modules/billing/billing.ts
Normal 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
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user