feat: 添加交易事件钩子,更新确认订单和订单列表组件以触发和监听交易事件
This commit is contained in:
1
src/events/index.ts
Normal file
1
src/events/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const tradeEvent = createEventHook<void>();
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user