fiee-official-website/src/store/stock-quote/index.js

20 lines
702 B
JavaScript
Raw Normal View History

import { ref } from 'vue'
import { createGlobalState, useLocalStorage } from '@vueuse/core'
import axios from 'axios'
export const useStockQuote = createGlobalState(() => {
const stockQuote = useLocalStorage('stockQuote', {})
const getStockQuate= async()=>{
const res = await axios.post('http://saas-test.szjixun.cn/api/chart/forward/test')
console.log('res',res);
stockQuote.value.Open=res.data.nodes?.[2]?.data?.[10]
stockQuote.value.Volume=res.data.nodes?.[1]?.data?.[20]
stockQuote.value.DayRange=[res.data.nodes?.[2]?.data?.[10],res.data.nodes?.[2]?.data?.[11]]
console.log('stockQuote.value',stockQuote.value);
}
return {
getStockQuate,
stockQuote
}
})