| | |
| | | socket.value = new WebSocket(`${WS_URL}/1/${props.symbol}`) |
| | | socket.value.onmessage = (evt) => { |
| | | const { data } = evt |
| | | const { code, data: _data } = JSON.parse(data) |
| | | let { code, data: _data } = JSON.parse(data) |
| | | // _data[0].high = Math.floor(Math.random() * 100) + 1 |
| | | // _data[0].low = Math.floor(Math.random() * 100) + 1 |
| | | // _data[0].close = Math.floor(Math.random() * 100) + 1 |
| | | // _data[0].open = Math.floor(Math.random() * 100) + 1 |
| | | if (code / 1 === 0) { |
| | | emits('data', _data[0]) |
| | | updateCharts(_data[0]) |
| | |
| | | width: quotesStore.stage === 'timeSharing' ? 0 : null, |
| | | } |
| | | }) |
| | | // quotesStore[SET_STAGE]({ stage: 'timeSharing', seconds: 1000 }) |
| | | |
| | | if (!quotesStore.stage) { |
| | | quotesStore[SET_STAGE]({ stage: '1min', seconds: 1 * 60 * 1000 }) |
| | | quotesStore[SET_STAGE]({ stage: '1min', seconds: 1000 }) |
| | | } |
| | | |
| | | emits('loading', true) |
| | |
| | | } |
| | | }) |
| | | if (!quotesStore.stage) { |
| | | quotesStore[SET_STAGE]({ stage: '1min', seconds: 1 * 60 * 1000 }) |
| | | quotesStore[SET_STAGE]({ stage: '1min', seconds: 1000 }) |
| | | } |
| | | // quotesStore[SET_STAGE]({ stage: 'timeSharing', seconds: 1000 }) |
| | | |
| | | // console.log(data.value) |
| | | |
| | | nextTick(() => { |