Balloon
Vue 已实现 · 还原验收 0/1 · 上游演示 · 固定版本源码
原设计:Avinit
预览
Multiplier1.00×
Waiting for a round
用法
vue
<script setup lang="ts">
import { onBeforeUnmount, ref } from 'vue'
import { CrashBalloon, type CrashReveal } from 'beui-vue'
const reveal = ref<CrashReveal | null>(null)
const receipt = ref('Waiting for a round')
let timer: ReturnType<typeof setTimeout> | undefined
function start(round: number) {
reveal.value = null
receipt.value = 'Waiting for reveal'
timer = setTimeout(() => { reveal.value = { round, value: 1.27 } }, 1600)
}
function confirm(value: number) { receipt.value = `Confirmed ${value.toFixed(2)}×` }
onBeforeUnmount(() => clearTimeout(timer))
</script>
<template><div><CrashBalloon :crash-at="reveal" @start="start" @cash-out="confirm" /><p>{{ receipt }}</p></div></template>API
使用 :crash-at="null" 开始等待揭晓。@start 接收回合编号,通过 { round, value } 揭晓对应回合,@cash-out 在有效结果确认后触发。示例在本地延迟揭晓。
上游变体
- Balloon · Avinit