24 lines
834 B
Vue
24 lines
834 B
Vue
<script setup lang="ts">
|
|
// 选项:duration 自动关闭时长(<=0 不关闭)、closable 手动关闭、handle.close() 立即关闭
|
|
import { G3Button, G3Message, G3Space } from '@g3soft/ui'
|
|
|
|
function openSticky() {
|
|
G3Message.error('这条不会自动消失,需要手动关闭', { duration: 0, closable: true })
|
|
}
|
|
|
|
function openAndClose() {
|
|
const handle = G3Message.info('1.5 秒后由代码关闭', { duration: 0 })
|
|
setTimeout(() => handle.close(), 1500)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<G3Space :size="[8, 8]" wrap>
|
|
<G3Button type="outline" @click="openSticky">不自动关闭</G3Button>
|
|
<G3Button type="outline" @click="openAndClose">代码关闭</G3Button>
|
|
<G3Button type="outline" @click="G3Message.success('5 秒后关闭', { duration: 5000 })">
|
|
自定义时长
|
|
</G3Button>
|
|
</G3Space>
|
|
</template>
|