feat: 添加交易事件钩子,更新确认订单和订单列表组件以触发和监听交易事件

This commit is contained in:
2026-01-13 20:08:57 +07:00
parent fc708f88d7
commit bc8da8a27a
3 changed files with 9 additions and 0 deletions

1
src/events/index.ts Normal file
View File

@@ -0,0 +1 @@
export const tradeEvent = createEventHook<void>();

View File

@@ -3,6 +3,7 @@ import type { SpotOrderBody } from "@/api/types";
import { modalController, toastController } from "@ionic/vue";
import { closeOutline } from "ionicons/icons";
import { client, safeClient } from "@/api";
import { tradeEvent } from "@/events";
import { tradeWayConfig } from "../config";
const props = defineProps<{
@@ -24,6 +25,7 @@ async function onConfirm() {
memo: props.form.memo,
price: props.form.price,
}));
tradeEvent.trigger();
const toast = await toastController.create({
message: "订单提交成功",
duration: 2000,

View File

@@ -3,6 +3,7 @@ import type { Treaty } from "@elysiajs/eden";
import type { InfiniteScrollCustomEvent } from "@ionic/vue";
import type { TreatyQuery } from "@/api/types";
import { client, safeClient } from "@/api";
import { tradeEvent } from "@/events";
import OrderCard from "./order-card.vue";
type Item = Treaty.Data<typeof client.api.spot_order.list.get>["data"][number];
@@ -50,6 +51,11 @@ async function handleInfinite(event: InfiniteScrollCustomEvent) {
}, 500);
}
tradeEvent.on(() => {
resetRwaData();
fetchData();
});
onBeforeMount(() => {
fetchData();
});