From 03f2acb415d46a3dfbbee3f397ea438ad6e73828 Mon Sep 17 00:00:00 2001 From: jiaoxueyan Date: Sat, 8 Feb 2025 16:49:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20Toast=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=A8=AA=E5=90=91=E6=8E=92=E7=89=88=E5=92=8C=E7=BA=B5=E5=90=91?= =?UTF-8?q?=E6=8E=92=E7=89=88(#780)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Toast支持横向排版和纵向排版 ✅ Closes: #780 --- docs/component/toast.md | 13 ++++++++++++ src/pages/toast/Index.vue | 15 ++++++++++++++ .../components/common/abstracts/variable.scss | 1 + .../components/wd-toast/index.scss | 8 ++++++++ .../components/wd-toast/index.ts | 2 +- .../components/wd-toast/types.ts | 1 + .../components/wd-toast/wd-toast.vue | 20 +++++++++++++++---- 7 files changed, 55 insertions(+), 5 deletions(-) diff --git a/docs/component/toast.md b/docs/component/toast.md index 8617be374..85148e37d 100644 --- a/docs/component/toast.md +++ b/docs/component/toast.md @@ -66,6 +66,18 @@ toast.show({ }) ``` +## 排版方向 + +`direction` 可设置排版方向,默认为横向排版。 + +```typescript +// 纵向排版 +toast.success({ + msg: '纵向排版', + direction: 'vertical' +}) +``` + ## 关闭提示 ```typescript @@ -107,6 +119,7 @@ toast.close() | ------------ | --------------------------------------------------------------------------- | ---------- | ------------------------- | ---------------------- | -------- | | msg | 消息内容 | string | - | - | - | | duration | 持续时间,单位 ms,为 0 时表示不自动关闭 | number | - | 2000 | - | +| direction | 排版方向 | string | vertical / horizonal | horizonal | $LOWEST_VERSION$ | | iconName | 图标类型 | string | success / error / warning | - | - | | iconSize | 左侧图标尺寸 | string | - | - | - | | iconClass | 图标类目,自定义图标,可以使用 Icon 章节的那些图标类名,iconName 优先级更高 | string | - | - | - | diff --git a/src/pages/toast/Index.vue b/src/pages/toast/Index.vue index e75e58a3b..0f838181d 100644 --- a/src/pages/toast/Index.vue +++ b/src/pages/toast/Index.vue @@ -23,6 +23,10 @@ Loading加载 ring类型loading + + 横向排版 + 纵向排版 + @@ -99,6 +103,17 @@ function showCustomIconToast() { msg: '使用自定义图标' }) } + +function showHorizonToast() { + toast.success('横向排版') +} + +function showVerticalToast() { + toast.success({ + msg: '纵向排版', + direction: 'vertical' + }) +}