feat: 添加 TradingView 相关环境变量和初始化逻辑;重构交易视图组件

This commit is contained in:
2025-12-30 00:09:38 +07:00
parent 0741b7b507
commit 2402337162
9 changed files with 119 additions and 66 deletions

View File

@@ -7,35 +7,6 @@ import TradeSwitch from "./components/trade-switch.vue";
import TradeWay from "./components/trade-way.vue";
const mode = ref<"buy" | "sell">("buy");
const tradingViewContainer = useTemplateRef<HTMLDivElement>("tradingViewContainer");
const { chart, series } = useTradingView(tradingViewContainer, {
data: [
{ time: "2024-01-01", open: 42000, high: 43100, low: 41800, close: 42500 },
{ time: "2024-01-02", open: 42500, high: 43500, low: 42200, close: 43000 },
{ time: "2024-01-03", open: 43000, high: 44200, low: 42800, close: 43800 },
{ time: "2024-01-04", open: 43800, high: 44500, low: 43500, close: 44200 },
{ time: "2024-01-05", open: 44200, high: 44800, low: 43900, close: 44500 },
{ time: "2024-01-06", open: 44500, high: 45000, low: 44200, close: 44800 },
{ time: "2024-01-07", open: 44800, high: 45500, low: 44500, close: 45250 },
{ time: "2024-01-08", open: 45250, high: 46000, low: 45100, close: 45800 },
{ time: "2024-01-09", open: 45800, high: 46200, low: 45500, close: 45600 },
{ time: "2024-01-10", open: 45600, high: 45900, low: 45200, close: 45400 },
{ time: "2024-01-11", open: 45400, high: 45800, low: 44900, close: 45100 },
{ time: "2024-01-12", open: 45100, high: 45500, low: 44700, close: 45200 },
{ time: "2024-01-13", open: 45200, high: 45800, low: 45000, close: 45600 },
{ time: "2024-01-14", open: 45600, high: 46500, low: 45500, close: 46300 },
{ time: "2024-01-15", open: 46300, high: 47000, low: 46200, close: 46800 },
],
});
onMounted(() => {
const panes = chart.value?.panes();
series.value?.applyOptions({
upColor: "#3fba6e",
downColor: "#f45531",
});
});
</script>
<template>
@@ -62,8 +33,7 @@ onMounted(() => {
</ion-toolbar>
</ion-header>
<ion-content :fullscreen="true">
<!-- <div ref="tradingViewContainer" class="h-50" /> -->
<TradingViewChart />
<TradingViewChart class="mb-5" />
<div class="grid grid-cols-5">
<div class="col-span-3 space-y-2">
<TradeSwitch v-model:active="mode" />