1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
| import { defineStore } from "pinia";
|
| export const useCurrencyStore = defineStore("currency", {
| // state 持久化,存储在了storage里面
| persist: true,
| state: () => {
| return {
| etfCurrency: [], //币种
| usStocksCurrency: [],
| coinCurrency: [],
| forexCurrency: [],
| };
| },
|
| actions: {
| updateCurrency(val, type) {
| switch (type) {
| case "etf":
| this.etfCurrency = val;
| break;
| case "usStocks":
| this.usStocksCurrency = val;
| break;
| case "coin":
| this.coinCurrency = val;
| break;
| default:
| this.forexCurrency = val;
| }
| },
| },
| });
|
|