mirror of
https://github.com/koel/koel
synced 2024-11-24 13:13:05 +00:00
chore: use UUID for message toaster
This commit is contained in:
parent
cb2fc8e15d
commit
e9fdc02485
1 changed files with 3 additions and 4 deletions
|
@ -8,18 +8,17 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
import { uuid } from '@/utils'
|
||||
import MessageToast from '@/components/ui/MessageToast.vue'
|
||||
|
||||
const messages = ref<ToastMessage[]>([])
|
||||
|
||||
const addMessage = (type: 'info' | 'success' | 'warning' | 'danger', content: string, timeout = 5) => {
|
||||
const id = `${Date.now().toString(36)}.${Math.random().toString(36)}`
|
||||
|
||||
messages.value.push({
|
||||
id,
|
||||
type,
|
||||
content,
|
||||
timeout
|
||||
timeout,
|
||||
id: uuid()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue