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

Commit 781f08e

Browse files
authored
Update README.md
1 parent 844d661 commit 781f08e

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

src/components/avatar/README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ styling on the content.
6161

6262
Use the `src` prop to specify a URL of an image to use as the avatar content. The image should have
6363
an aspect ratio of `1:1` (meaning the width and height should be equal), otherwise image aspect
64-
distortion will occur. The image will be scaled up or down to fit within the avatar's bounding box,
65-
and will be sized to show the avatar's [variant background](#variants) around the edge.
64+
distortion will occur. The image will be scaled up or down to fit within the avatar's bounding box.
6665

6766
```html
6867
<template>
@@ -84,8 +83,9 @@ and will be sized to show the avatar's [variant background](#variants) around th
8483
fallback to the value of the `icon` or `text` props. If neither the `icon` or `text` props are
8584
provided, then the default avatar icon will be shown. Also, when the image fails to load, the
8685
`img-error` event will be emitted.
87-
- <span class="badge badge-secondary">2.12.0+</span> Setting the [variant prop](#variants) to an
88-
empty string will remove the visible background border around the image.
86+
- [Variant colors](#variants) when using images not not normally visible, unless the image fails
87+
load. The variant will affect the focus styling when the image avatar is also an
88+
[actionalble avatar](#actionalble-avatars).
8989

9090
### Icon content
9191

@@ -270,6 +270,8 @@ Easily create avatars that respond to clicks, or avatars that change the URL/rou
270270
Actionable avatars will appear in the document tab sequence, and are accessible for both screen
271271
reader and keyboard-only users.
272272

273+
Image avatars, when actionalble, employ a basic scale transform on the image when hovered.
274+
273275
### Button
274276

275277
Want to trigger the opening of a modal or trigger an action? Set the `button` prop to instruct
@@ -278,10 +280,20 @@ the `click` event whenever clicked.
278280

279281
```html
280282
<template>
281-
<div>
282-
<b-avatar button @click="onClick" variant="primary" text="FF" class="align-baseline"></b-avatar>
283-
Button Avatar
284-
</div>
283+
<b-list-group>
284+
<b-list-group-item>
285+
<b-avatar button @click="onClick" variant="primary" text="FF" class="align-baseline"></b-avatar>
286+
Button Text Avatar
287+
</b-list-group-item>
288+
<b-list-group-item>
289+
<b-avatar button @click="onClick" src="https://placekitten.com/300/300"></b-avatar>
290+
Button Image Avatar
291+
</b-list-group-item>
292+
<b-list-group-item>
293+
<b-avatar button @click="onClick" icon="star-fill" class="align-center"></b-avatar>
294+
Button Icon Avatar
295+
</b-list-group-item>
296+
</b-list-group>
285297
</template>
286298

287299
<script>
@@ -315,10 +327,20 @@ The `to` prop can either be a string path, or a `Location` object. The `to` prop
315327

316328
```html
317329
<template>
318-
<div>
319-
<b-avatar href="#foobar" variant="info" src="https://placekitten.com/300/300"></b-avatar>
320-
Link Avatar
321-
</div>
330+
<b-list-group>
331+
<b-list-group-item>
332+
<b-avatar href="#foo" variant="primary" text="FF" class="align-baseline"></b-avatar>
333+
Link Text Avatar
334+
</b-list-group-item>
335+
<b-list-group-item>
336+
<b-avatar href="#bar" src="https://placekitten.com/300/300"></b-avatar>
337+
Link Image Avatar
338+
</b-list-group-item>
339+
<b-list-group-item>
340+
<b-avatar href="#baz" icon="star-fill" class="align-center"></b-avatar>
341+
Link Icon Avatar
342+
</b-list-group-item>
343+
</b-list-group>
322344
</template>
323345

324346
<!-- b-avatar-href.vue -->

0 commit comments

Comments
 (0)