From 14f9844430a8ccceac963959be79b04255129534 Mon Sep 17 00:00:00 2001 From: oneao Date: Thu, 11 Sep 2025 21:54:25 +0800 Subject: [PATCH] u --- .../ao-design/src/notification/index.scss | 18 ++++++++++++------ .../ao-design/src/notification/index.ts | 16 ++++++++++------ .../ao-design/src/notification/item.tsx | 8 +++----- code/base-project/base-vue/src/App.vue | 6 ++---- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/code/base-project/base-vue/packages/ao-design/src/notification/index.scss b/code/base-project/base-vue/packages/ao-design/src/notification/index.scss index 7ba52c38..9f3f7701 100644 --- a/code/base-project/base-vue/packages/ao-design/src/notification/index.scss +++ b/code/base-project/base-vue/packages/ao-design/src/notification/index.scss @@ -12,9 +12,9 @@ $notification-prefix: #{$prefix}-notification; } .#{$notification-prefix} { - width: 360px; + min-width: 360px; padding: 12px 16px; - border-radius: $border-radius; + border-radius: 4px; background-color: $bg-color-container; color: $text-color-base; box-shadow: $shadow-overlay; @@ -24,6 +24,7 @@ $notification-prefix: #{$prefix}-notification; border: 0; margin: 0; display: flex; + background-color: #ecf7ec; &-icon { text-align: center; @@ -37,21 +38,26 @@ $notification-prefix: #{$prefix}-notification; &-title-wrapper { display: flex; - justify-content: space-between; align-items: center; + word-break: break-all; + box-sizing: border-box; + line-height: 20px; } &-title { font-size: 16px; - font-weight: bold; + font-weight: 600; + line-height: 1; + small { - margin-left: 4px; + margin: 0px 6px; + font-size: 14px; } } &-close { flex-shrink: 0; - margin-left: 6px; + margin-left: auto; color: $text-color-assist; cursor: pointer; border-radius: $border-radius; diff --git a/code/base-project/base-vue/packages/ao-design/src/notification/index.ts b/code/base-project/base-vue/packages/ao-design/src/notification/index.ts index ca855229..c2c270ed 100644 --- a/code/base-project/base-vue/packages/ao-design/src/notification/index.ts +++ b/code/base-project/base-vue/packages/ao-design/src/notification/index.ts @@ -50,12 +50,16 @@ function getContainer(placement: Placement = 'top-end') { } function getTransform(placement: Placement, hidden: boolean) { - if (placement.startsWith('top')) - return hidden ? 'translateY(-10px)' : 'translateY(0)' - if (placement.startsWith('bottom')) - return hidden ? 'translateY(10px)' : 'translateY(0)' - - return hidden ? 'translateY(-10px)' : 'translateY(0)' + switch (placement) { + case 'top-start': + case 'bottom-start': + return hidden ? 'translateX(-10px)' : 'translateX(0)' + case 'top-end': + case 'bottom-end': + return hidden ? 'translateX(10px)' : 'translateX(0)' + default: + return hidden ? 'translateX(-10px)' : 'translateX(0)' + } } export function useNotification(): MessageFn { diff --git a/code/base-project/base-vue/packages/ao-design/src/notification/item.tsx b/code/base-project/base-vue/packages/ao-design/src/notification/item.tsx index a58247d8..0e9e0fdf 100644 --- a/code/base-project/base-vue/packages/ao-design/src/notification/item.tsx +++ b/code/base-project/base-vue/packages/ao-design/src/notification/item.tsx @@ -42,7 +42,7 @@ export default defineComponent({ > @@ -50,10 +50,8 @@ export default defineComponent({
-
- {props.title} - {props.subTitle} -
+ {props.title} + {props.subTitle}
{props.showClose ? ( diff --git a/code/base-project/base-vue/src/App.vue b/code/base-project/base-vue/src/App.vue index 26a4e279..81efaba0 100644 --- a/code/base-project/base-vue/src/App.vue +++ b/code/base-project/base-vue/src/App.vue @@ -6,12 +6,10 @@ const notification = useNotification() function showCustomMessage() { notification.success({ - title: '自定义消息', + title: '测试', + subTitle: '测试2222222222222222222222222222222222222222222222222', message: () => h('div', { style: { color: 'red', position: 'relative' } }, [ - h('p', {}, '这里是自定义内容,可以是任意 VNode'), - h('strong', {}, '加粗文本'), - // 右下角按钮容器 h( 'div', {