🌐 AI搜索 & 代理 主页
Skip to content

Commit 1d1267f

Browse files
authored
Update avatar.js
1 parent a60dbae commit 1d1267f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/components/avatar/avatar.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,12 @@ const props = {
144144
const computeSize = value => {
145145
// Default to `md` size when `null`, or parse to
146146
// number when value is a float-like string
147-
value = isUndefinedOrNull(value) || value === ''
148-
? 'md'
149-
: isString(value) && RX_NUMBER.test(value)
150-
? toFloat(value, 0)
151-
: value
147+
value =
148+
isUndefinedOrNull(value) || value === ''
149+
? 'md'
150+
: isString(value) && RX_NUMBER.test(value)
151+
? toFloat(value, 0)
152+
: value
152153
// Convert all numbers to pixel values
153154
// Handle default sizes when `sm`, `md` or `lg`
154155
// Or use value as is
@@ -171,8 +172,14 @@ export const BAvatar = /*#__PURE__*/ Vue.extend({
171172
},
172173
computed: {
173174
computedSize() {
175+
// Always use the avatar group size
174176
return computeSize(this.bvAvatarGroup ? this.bvAvatarGroup.size : this.size)
175177
},
178+
computedVariant() {
179+
// Prefer avatar-group variant if provided
180+
const avatarGroup = this.bvAvatarGroup
181+
return avatarGroup && avatarGroup.variant ? avatarGroup.variant : this.variant
182+
},
176183
fontSize() {
177184
const size = this.computedSize
178185
return size ? `calc(${size} * ${FONT_SIZE_SCALE})` : null
@@ -207,7 +214,7 @@ export const BAvatar = /*#__PURE__*/ Vue.extend({
207214
},
208215
render(h) {
209216
const {
210-
variant,
217+
computedVariant: variant,
211218
disabled,
212219
square,
213220
icon,

0 commit comments

Comments
 (0)