14 lines
271 B
JavaScript
14 lines
271 B
JavaScript
|
|
import { ref } from 'vue'
|
||
|
|
|
||
|
|
export function useToast() {
|
||
|
|
const toastText = ref('')
|
||
|
|
|
||
|
|
function toast(text) {
|
||
|
|
toastText.value = text
|
||
|
|
clearTimeout(toast.timer)
|
||
|
|
toast.timer = setTimeout(() => { toastText.value = '' }, 3200)
|
||
|
|
}
|
||
|
|
|
||
|
|
return { toastText, toast }
|
||
|
|
}
|