Skip to content

Commit 3363fd7

Browse files
author
weilei
committed
refactor(core): 移除不必要的avatarIcon属性,优化样式逻辑,确保头像尺寸正确
1 parent b7f4109 commit 3363fd7

File tree

3 files changed

+15
-42
lines changed

3 files changed

+15
-42
lines changed

packages/element-ui-x/src/components/Bubble/src/main.vue

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828
class="el-x-bubble-avatar el-x-bubble-avatar-size"
2929
>
3030
<el-avatar
31-
:size="avatarSize"
31+
:size="0"
3232
:src="avatar"
3333
:shape="avatarShape"
34-
:icon="avatarIcon"
3534
:src-set="avatarSrcSet"
3635
:alt="avatarAlt"
3736
@error="avatarError"
@@ -64,12 +63,12 @@
6463
class="el-x-bubble-content"
6564
:class="{
6665
'el-x-bubble-content-loading': loading,
67-
'el-x-bubble-content-round': shape === 'round',
68-
'el-x-bubble-content-corner': shape === 'corner',
69-
'el-x-bubble-content-filled': variant === 'filled',
70-
'el-x-bubble-content-borderless': variant === 'borderless',
71-
'el-x-bubble-content-outlined': variant === 'outlined',
72-
'el-x-bubble-content-shadow': variant === 'shadow',
66+
'el-x-bubble-content-round': shape === 'round' && !noStyle,
67+
'el-x-bubble-content-corner': shape === 'corner' && !noStyle,
68+
'el-x-bubble-content-filled': variant === 'filled' && !noStyle,
69+
'el-x-bubble-content-borderless': variant === 'borderless' && !noStyle,
70+
'el-x-bubble-content-outlined': variant === 'outlined' && !noStyle,
71+
'el-x-bubble-content-shadow': variant === 'shadow' && !noStyle,
7372
}"
7473
>
7574
<div
@@ -134,18 +133,12 @@
134133
135134
export default {
136135
name: 'ElXBubble',
137-
components: {
138-
ElXTypewriter,
139-
},
136+
components: { ElXTypewriter },
140137
props: {
141138
content: {
142139
type: String,
143140
default: '',
144141
},
145-
reasoning_content: {
146-
type: String,
147-
default: '',
148-
},
149142
avatar: {
150143
type: String,
151144
default: '',
@@ -174,10 +167,6 @@
174167
type: String,
175168
default: 'circle',
176169
},
177-
avatarIcon: {
178-
type: String,
179-
default: '',
180-
},
181170
avatarSrcSet: {
182171
type: String,
183172
default: '',

packages/element-ui-x/src/components/BubbleList/src/main.vue

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
:avatar-size="defaultAvatarSize || item.avatarSize"
3838
:avatar-gap="defaultAvatarGap || item.avatarGap"
3939
:avatar-shape="defaultAvatarShape || item.avatarShape"
40-
:avatar-icon="defaultAvatarIcon || item.avatarIcon"
4140
:avatar-src-set="defaultAvatarSrcSet || item.avatarSrcSet"
4241
:avatar-alt="defaultAvatarAlt || item.avatarAlt"
4342
:avatar-fit="defaultAvatarFit || item.avatarFit"
@@ -48,19 +47,7 @@
4847
<slot
4948
name="avatar"
5049
:item="item"
51-
>
52-
<template v-if="defaultAvatar || item.avatar">
53-
<el-avatar
54-
:size="defaultAvatarSize || item.avatarSize || 40"
55-
:src="defaultAvatar || item.avatar"
56-
:shape="defaultAvatarShape || item.avatarShape || 'circle'"
57-
:icon="defaultAvatarIcon || item.avatarIcon"
58-
:src-set="defaultAvatarSrcSet || item.avatarSrcSet"
59-
:alt="defaultAvatarAlt || item.avatarAlt"
60-
:fit="defaultAvatarFit || item.avatarFit || 'cover'"
61-
/>
62-
</template>
63-
</slot>
50+
></slot>
6451
</template>
6552
<template
6653
v-if="$scopedSlots.header || $slots.header"
@@ -129,9 +116,9 @@
129116
</template>
130117

131118
<script>
119+
import createScrollDetector from '../../../utils/scrollDetector';
132120
import Bubble from '../../Bubble/index.js';
133121
import loadingBg from './loading.vue';
134-
import createScrollDetector from '../../../utils/scrollDetector';
135122
136123
export default {
137124
name: 'ElXBubbleList',
@@ -232,10 +219,6 @@
232219
type: String,
233220
default: '',
234221
},
235-
defaultAvatarIcon: {
236-
type: String,
237-
default: '',
238-
},
239222
defaultAvatarSrcSet: {
240223
type: String,
241224
default: '',

packages/element-ui-x/src/styles/Bubble.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
.el-x-bubble-avatar-size {
99
::v-deep .el-avatar {
10-
width: var(--el-x-bubble-avatar-placeholder-width);
11-
height: var(--el-x-bubble-avatar-placeholder-height);
10+
width: var(--el-x-bubble-avatar-placeholder-width) !important;
11+
height: var(--el-x-bubble-avatar-placeholder-height) !important;
1212
}
1313
}
1414

1515
.el-x-bubble-avatar-placeholder {
16-
width: var(--el-x-bubble-avatar-placeholder-width);
17-
height: var(--el-x-bubble-avatar-placeholder-height);
16+
width: var(--el-x-bubble-avatar-placeholder-width) !important;
17+
height: var(--el-x-bubble-avatar-placeholder-height) !important;
1818
}
1919

2020
.el-x-bubble-start {
@@ -139,6 +139,7 @@
139139

140140
/* 波浪动画 */
141141
@keyframes wave {
142+
142143
0%,
143144
100% {
144145
transform: translateY(-2px);

0 commit comments

Comments
 (0)