From 4367b3b8cd087a17e2607a7fa739664862fd950a Mon Sep 17 00:00:00 2001 From: ding Date: Thu, 25 Nov 2021 01:00:28 +0800 Subject: [PATCH] feat: tvjs --- src/libs/osmos.js | 18 +++++++------- src/views/OsmosisTrade.vue | 10 +++++--- src/views/components/tvjs/TestOverlay.vue | 3 --- src/views/components/tvjs/data.json | 2 +- src/views/components/tvjs/index.vue | 30 ++++++++++++++++------- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/libs/osmos.js b/src/libs/osmos.js index 0a294eb2..c3d5385d 100644 --- a/src/libs/osmos.js +++ b/src/libs/osmos.js @@ -3,7 +3,7 @@ * @Autor: dingyiming * @Date: 2021-11-22 21:20:10 * @LastEditors: dingyiming - * @LastEditTime: 2021-11-23 11:19:51 + * @LastEditTime: 2021-11-25 00:45:16 */ import fetch from 'node-fetch' import { getLocalChains } from './data/data' @@ -47,14 +47,14 @@ export default class OsmosAPI { const result = [] for (let i = 0; i < output.length; i += 1) { const itemArr = output[i] - result.push({ - time: itemArr[0], - volume: 0, - open: itemArr[1], - high: itemArr[2], - low: itemArr[3], - close: itemArr[4], - }) + result.push([ + itemArr[0], + itemArr[1], // open + itemArr[2], // high + itemArr[3], // low + itemArr[4], // close + 0, // volume + ]) } return result }) diff --git a/src/views/OsmosisTrade.vue b/src/views/OsmosisTrade.vue index fe24ef52..f4b2e7b2 100644 --- a/src/views/OsmosisTrade.vue +++ b/src/views/OsmosisTrade.vue @@ -64,8 +64,10 @@
-
-
- +
+
@@ -131,7 +133,8 @@ export default { }, }, created() { - const { base, target } = this.$route.params + const base = this.$route.params?.base || 'ATOM' + const target = this.$route.params?.target || 'OSMO' this.init(base, target) // 所有方法添加到 $http.osmosis this.$http.osmosis.getOHCL4Pairs( @@ -139,6 +142,7 @@ export default { this.$http.osmosis.getCoinGeckoId(target), ) .then(data => { + console.log(data) this.klineData = data }) }, diff --git a/src/views/components/tvjs/TestOverlay.vue b/src/views/components/tvjs/TestOverlay.vue index 0ed5b6a9..9b7cb63b 100644 --- a/src/views/components/tvjs/TestOverlay.vue +++ b/src/views/components/tvjs/TestOverlay.vue @@ -1,8 +1,5 @@