2026-05-30 23:32:22 +08:00
|
|
|
import { Text, createApp, useAnimation, useApp } from "@vue-tui/runtime";
|
2026-05-27 01:28:29 +08:00
|
|
|
import { defineComponent, h, watch } from "vue";
|
2026-05-26 23:12:00 +08:00
|
|
|
|
|
|
|
|
const Spinner = defineComponent(() => {
|
|
|
|
|
const { frame } = useAnimation({ interval: 8 });
|
2026-05-30 23:32:22 +08:00
|
|
|
const { exit } = useApp();
|
2026-05-26 23:12:00 +08:00
|
|
|
|
|
|
|
|
watch(frame, (value) => {
|
|
|
|
|
if (value >= 3) {
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2026-05-27 01:28:29 +08:00
|
|
|
return () => h(Text, null, String(frame.value));
|
2026-05-26 23:12:00 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const app = createApp(Spinner);
|
|
|
|
|
app.mount({ interactive: false });
|
|
|
|
|
|
|
|
|
|
await app.waitUntilExit();
|
|
|
|
|
console.log("exited");
|