Files
vue-tui/packages/runtime-tests/integration/pty/fixtures/use-animation-interactive-false-exit.tsx
T

22 lines
496 B
TypeScript
Raw Normal View History

import { Text, createApp, useAnimation, useApp } from "@vue-tui/runtime";
import { defineComponent, h, watch } from "vue";
const Spinner = defineComponent(() => {
const { frame } = useAnimation({ interval: 8 });
const { exit } = useApp();
watch(frame, (value) => {
if (value >= 3) {
exit();
}
});
return () => h(Text, null, String(frame.value));
});
const app = createApp(Spinner);
app.mount({ interactive: false });
await app.waitUntilExit();
console.log("exited");