feat: 移除未使用的提示服务功能,优化按钮逻辑以支持不同的提示类型
This commit is contained in:
@ -56,14 +56,6 @@ export const openDialog = async () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const openToast = () => {
|
|
||||||
// ToastService.add({ severity: 'info', summary: '提示', life: 3000, detail: '消息内容' });
|
|
||||||
// ToastService.add({ severity: 'info', summary: '提示', life: 0, detail: '消息内容' });
|
|
||||||
['success', 'info', 'warn', 'error', 'secondary', 'contrast', undefined].forEach((severity) => {
|
|
||||||
ToastService.add({ severity: severity as never, summary: `severity: ${severity}`, life: 5000, detail: '消息内容' });
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const openConfirm = async () => {
|
export const openConfirm = async () => {
|
||||||
ConfirmationService.require({
|
ConfirmationService.require({
|
||||||
message: '确定要继续吗?',
|
message: '确定要继续吗?',
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<script lang="ts"></script>
|
<script lang="ts"></script>
|
||||||
|
|
||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { openConfirm, openDialog, openToast } from './fns';
|
import type { ToastMessageOptions } from 'primevue/toast';
|
||||||
|
import { openConfirm, openDialog } from './fns';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -42,7 +43,35 @@ import { openConfirm, openDialog, openToast } from './fns';
|
|||||||
<label>DatePicker</label>
|
<label>DatePicker</label>
|
||||||
</FloatLabel>
|
</FloatLabel>
|
||||||
|
|
||||||
<Button @click="openToast">提示服务</Button>
|
<!-- <Button @click="openToast">提示服务</Button> -->
|
||||||
|
<Card>
|
||||||
|
<template #title>提示服务</template>
|
||||||
|
<template #content>
|
||||||
|
<div flex="~ wrap" gap="4">
|
||||||
|
<!-- oastService.add({ severity: 'info', summary: '提示', life: 3000, detail: '消息内容' }); -->
|
||||||
|
<!-- oastService.add({ severity: 'info', summary: '提示', life: 0, detail: '消息内容' }); -->
|
||||||
|
<Button
|
||||||
|
outlined
|
||||||
|
v-for="severity in [
|
||||||
|
'success',
|
||||||
|
'info',
|
||||||
|
'warn',
|
||||||
|
'error',
|
||||||
|
'secondary',
|
||||||
|
'contrast',
|
||||||
|
undefined,
|
||||||
|
] satisfies ToastMessageOptions['severity'][]"
|
||||||
|
:key="severity"
|
||||||
|
@click="
|
||||||
|
ToastService.add({ severity: severity, summary: `severity: ${severity}`, life: 5000, detail: '消息内容' })
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ `${severity}` }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<Button @click="openDialog">对话框服务</Button>
|
<Button @click="openDialog">对话框服务</Button>
|
||||||
<Button @click="openConfirm">确认服务</Button>
|
<Button @click="openConfirm">确认服务</Button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user