feat: 更新 @riwa/api-types 依赖至 0.0.89,优化交易对和图表组件
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
"@elysiajs/eden": "^1.4.5",
|
||||
"@ionic/vue": "^8.7.11",
|
||||
"@ionic/vue-router": "^8.7.11",
|
||||
"@riwa/api-types": "http://192.168.1.17:9527/api/riwa-eden-0.0.87.tgz",
|
||||
"@riwa/api-types": "http://192.168.1.17:9527/api/riwa-eden-0.0.89.tgz",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"@vee-validate/yup": "^4.15.1",
|
||||
"@vueuse/core": "^14.1.0",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -57,8 +57,8 @@ importers:
|
||||
specifier: ^8.7.11
|
||||
version: 8.7.11(@stencil/core@4.39.0)(vue-router@4.6.3(vue@3.5.25(typescript@5.9.3)))(vue@3.5.25(typescript@5.9.3))
|
||||
'@riwa/api-types':
|
||||
specifier: http://192.168.1.17:9527/api/riwa-eden-0.0.87.tgz
|
||||
version: '@riwa/eden@http://192.168.1.17:9527/api/riwa-eden-0.0.87.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))'
|
||||
specifier: http://192.168.1.17:9527/api/riwa-eden-0.0.89.tgz
|
||||
version: '@riwa/eden@http://192.168.1.17:9527/api/riwa-eden-0.0.89.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))'
|
||||
'@tailwindcss/vite':
|
||||
specifier: ^4.1.18
|
||||
version: 4.1.18(vite@7.2.7(@types/node@24.10.2)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(yaml@2.8.2))
|
||||
@@ -2766,9 +2766,9 @@ packages:
|
||||
'@remirror/core-constants@3.0.0':
|
||||
resolution: {integrity: sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==}
|
||||
|
||||
'@riwa/eden@http://192.168.1.17:9527/api/riwa-eden-0.0.87.tgz':
|
||||
resolution: {tarball: http://192.168.1.17:9527/api/riwa-eden-0.0.87.tgz}
|
||||
version: 0.0.87
|
||||
'@riwa/eden@http://192.168.1.17:9527/api/riwa-eden-0.0.89.tgz':
|
||||
resolution: {tarball: http://192.168.1.17:9527/api/riwa-eden-0.0.89.tgz}
|
||||
version: 0.0.89
|
||||
peerDependencies:
|
||||
'@elysiajs/eden': ^1.4.5
|
||||
|
||||
@@ -12077,7 +12077,7 @@ snapshots:
|
||||
|
||||
'@remirror/core-constants@3.0.0': {}
|
||||
|
||||
'@riwa/eden@http://192.168.1.17:9527/api/riwa-eden-0.0.87.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
'@riwa/eden@http://192.168.1.17:9527/api/riwa-eden-0.0.89.tgz(@elysiajs/eden@1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
dependencies:
|
||||
'@elysiajs/eden': 1.4.5(elysia@1.4.18(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
||||
|
||||
|
||||
@@ -68,6 +68,9 @@ const defaultOptions = {
|
||||
},
|
||||
} satisfies ChartingLibraryWidgetOptions;
|
||||
|
||||
export interface TradingViewChartExpose {
|
||||
}
|
||||
|
||||
export const TradingViewChart = defineComponent({
|
||||
name: "TradingViewChart",
|
||||
props: {
|
||||
@@ -141,6 +144,17 @@ export const TradingViewChart = defineComponent({
|
||||
}, 0);
|
||||
});
|
||||
|
||||
// 监听交易对变化,动态更新图表数据
|
||||
watch(() => props.symbol, (newSymbol) => {
|
||||
if (!widget.value || !newSymbol)
|
||||
return;
|
||||
widget.value.activeChart().setSymbol(newSymbol, () => {
|
||||
console.log(`[TradingView]: Symbol changed to ${newSymbol}`);
|
||||
});
|
||||
});
|
||||
|
||||
return () => h("div", { ref: el, class: "w-full", style: styles.value });
|
||||
},
|
||||
});
|
||||
|
||||
export type TradingViewInst = InstanceType<typeof TradingViewChart> & TradingViewChartExpose;
|
||||
|
||||
@@ -6,7 +6,11 @@ const emit = defineEmits<{
|
||||
select: [symbol: string];
|
||||
}>();
|
||||
|
||||
const { data } = safeClient(client.api.trading_pairs.get());
|
||||
const [query] = useResetRef({
|
||||
offset: 0,
|
||||
limit: 200,
|
||||
});
|
||||
const { data } = safeClient(client.api.trading_pairs.get({ query: query.value }));
|
||||
const searchText = ref("");
|
||||
|
||||
function handleSelect(symbol: string) {
|
||||
@@ -22,7 +26,7 @@ function handleSelect(symbol: string) {
|
||||
|
||||
<ion-content>
|
||||
<div class="mt-2 flex flex-col">
|
||||
<div v-for="item in data" :key="item.symbol" class="flex items-center px-3 my-3 w-full" @click="handleSelect(item.symbol)">
|
||||
<div v-for="item in data?.data" :key="item.symbol" class="flex items-center px-3 my-3 w-full" @click="handleSelect(item.symbol)">
|
||||
<Icon icon="cryptocurrency-color:dta" class="text-3xl" />
|
||||
<div class="ml-2 inline-flex gap-2 items-baseline">
|
||||
<span class="font-medium text-md">{{ item.baseAsset }}</span><span class="text-xs text-text-400">/ {{ item.quoteAsset }}</span>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { ChartingLibraryWidgetOptions } from "#/charting_library";
|
||||
import type { TradingViewInst } from "@/tradingview/index";
|
||||
import { modalController } from "@ionic/vue";
|
||||
import { useRouteQuery } from "@vueuse/router";
|
||||
import { caretDownOutline, ellipsisHorizontal } from "ionicons/icons";
|
||||
@@ -20,19 +21,11 @@ const tradingviewOptions: Partial<ChartingLibraryWidgetOptions> = {
|
||||
"create_volume_indicator_by_default",
|
||||
],
|
||||
};
|
||||
|
||||
const { data } = safeClient(client.api.trading_pairs.get());
|
||||
const tradingViewInst = useTemplateRef<TradingViewInst>("tradingViewInst");
|
||||
|
||||
async function openTradePairs() {
|
||||
if (!data.value)
|
||||
return;
|
||||
|
||||
const modal = await modalController.create({
|
||||
component: TradePairsModal,
|
||||
componentProps: {
|
||||
tradingPairs: data.value,
|
||||
currentSymbol: symbol.value,
|
||||
},
|
||||
breakpoints: [0, 0.95],
|
||||
initialBreakpoint: 0.95,
|
||||
handle: true,
|
||||
@@ -72,7 +65,7 @@ async function openTradePairs() {
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content :fullscreen="true">
|
||||
<TradingViewChart class="mb-5" height="300px" :symbol="symbol" :options="tradingviewOptions" />
|
||||
<TradingViewChart ref="tradingViewInst" class="mb-5" height="300px" :symbol="symbol" :options="tradingviewOptions" />
|
||||
|
||||
<div class="grid grid-cols-5 px-4">
|
||||
<div class="col-span-3 space-y-2">
|
||||
|
||||
Reference in New Issue
Block a user