tiny-vue_version0/examples/sites/demos/pc/app/notify/notify-events-composition-a...

36 lines
1.2 KiB
Vue

<template>
<div class="content">
<tiny-button @click="baseClick" :reset-time="0">关闭前的事件</tiny-button>
<tiny-button @click="baseClick2" :reset-time="0">点击关闭按钮时触发事件</tiny-button>
</div>
</template>
<script setup>
import { Button as TinyButton, Notify, Modal } from '@opentiny/vue'
function baseClick() {
Notify({
type: 'info',
title: '通知',
message: '通知消息的正文,通知消息的正文,通知消息的正文,通知消息的正文,通知消息的正文,通知消息的正文',
beforeClose: () => {
Modal.message({ message: '在通知框关闭前触发的事件,返回 false 可阻止关闭通知框', status: 'info' })
return false
},
duration: 500000,
position: 'top-right'
})
}
function baseClick2() {
Notify({
type: 'info',
title: '通知',
message: '通知消息的正文,通知消息的正文,通知消息的正文,通知消息的正文,通知消息的正文,通知消息的正文',
onClose: () => Modal.message({ message: '点击关闭按钮时触发事件', status: 'info' }),
duration: 500000,
position: 'top-right'
})
}
</script>