u
This commit is contained in:
1 parent
6d4f1ee402
commit
14f9844430
4 files changed
+27
-21
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -42,7 +42,7 @@ export default defineComponent({
|
||||
>
|
||||
<Icon
|
||||
icon={iconMap[props.type ?? 'info']}
|
||||
size={26}
|
||||
size={22}
|
||||
class={`${prefixCls}-icon ${prefixCls}-${props.type ?? 'info'}`}
|
||||
spin={props.type === 'loading'}
|
||||
/>
|
||||
@@ -50,10 +50,8 @@ export default defineComponent({
|
||||
<div class={`${prefixCls}-main`}>
|
||||
<div class={`${prefixCls}-title-wrapper`}>
|
||||
<span class={`${prefixCls}-title`}>
|
||||
<div>
|
||||
{props.title}
|
||||
<small>{props.subTitle}</small>
|
||||
</div>
|
||||
{props.title}
|
||||
<small>{props.subTitle}</small>
|
||||
</span>
|
||||
{props.showClose
|
||||
? (
|
||||
|
||||
@@ -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',
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user