lxf
2025-07-07 93f9b248dd0eecbaa77006e5146c58c831d89d8e
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { defineStore } from 'pinia'
import { SET_COIN_LIST, SET_STAGE, SET_CURRENCY, SET_HISTORY_LIST, OPCIONA_LIST, CITAS_LIST, IS_LOAD } from '@/store/types.store'
import { _getCoinList } from '@/service/quotes.api';
import { defaultStage, defaultSeconds } from '@/config';
 
export const useQuotesStore = defineStore('qoutes', {
    // state 持久化
    persist: true,
    state: () => ('quotes', {
        coins: [],
        stage: defaultStage, // 阶段
        seconds: defaultSeconds,
        currency: '',
        historyList: [], // 搜索历史
        opcionalList: [], // 自选list
        citasList: [],
        isLoad: 1
        // name: 'Eduardo',
        // token: 'token' // token值
    }),
    getters: {
        coinList: (state) => state.coins,
        // historyList: (state) => state.historyList
        // stage: state => state.stage
    },
    actions: {
        async [SET_COIN_LIST]() {
            const result = await _getCoinList()
            this.coins = result
        },
        [SET_STAGE]({ stage, seconds }) {
            this.stage = stage
            this.seconds = seconds
        },
        [SET_HISTORY_LIST](list) { // 搜索历史
            this.historyList = list
        },
        [OPCIONA_LIST](list) { // 自选list
            console.log(list)
            this.opcionalList = list
        },
        [OPCIONA_LIST](list) { // 自选list
            console.log(list)
            this.opcionalList = list
        },
        [CITAS_LIST](list) { // 自选list
            console.log(list)
            this.citasList = list
        },
        [IS_LOAD](val) { // 是否加载
            this.isLoad = val
        },
    },
})