From b0b65b454c2d6848adc5723bbc51dc37117225fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 29 Oct 2025 00:13:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(toast):=20=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E9=94=AE=E6=89=93=E5=BC=80=E6=89=80=E6=9C=89=20Toast=20?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 ++ src/pages/demos/primevue-demo.page.vue | 38 ++++++++++++++++++-------- vite.config.rollup.ts | 2 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.env b/.env index e2efb89..22e9cf9 100644 --- a/.env +++ b/.env @@ -10,3 +10,5 @@ VITE_APP_ENABLE_VUE_DEVTOOLS=true VITE_APP_MENU_SHOW_DEMOS=true VITE_APP_MENU_SHOW_ORDER=true VITE_APP_ENABLE_ROUTER_LOG_GUARD=true +VITE_APP_API_URL=/API +VITE_APP_PROXY=[["/API","https://jsonplaceholder.typicode.com"]] diff --git a/src/pages/demos/primevue-demo.page.vue b/src/pages/demos/primevue-demo.page.vue index 3de4b02..724535b 100644 --- a/src/pages/demos/primevue-demo.page.vue +++ b/src/pages/demos/primevue-demo.page.vue @@ -4,6 +4,29 @@ import type { ToastMessageOptions } from 'primevue/toast'; definePage({ meta: {}, }); + +const tostSeverities = [ + 'secondary', + 'success', + 'info' /* 默认 */, + 'warn', + 'error', + 'contrast', + undefined, +] satisfies ToastMessageOptions['severity'][]; + +const openAllToasts = () => { + tostSeverities.forEach((severity, index) => { + setTimeout(() => { + ToastService.add({ + severity, + summary: `severity: ${severity ?? 'default'}`, + life: 3000, + detail: `${index + 1}. 消息内容`, + }); + }, index * 500); + }); +}; diff --git a/vite.config.rollup.ts b/vite.config.rollup.ts index 546593c..13b09b6 100644 --- a/vite.config.rollup.ts +++ b/vite.config.rollup.ts @@ -101,7 +101,7 @@ export const viteConfigRollupOptions: RollupOptions = { } if ( - ['primelocale', 'primevue', '@primeuix', 'primeicons'].some((name) => + ['primelocale', 'primevue', 'primeuix', 'primeicons'].some((name) => packageName!.includes(name), ) ) {