layui/example/docs/zh-CN/components/avatar.md

142 lines
2.2 KiB
Markdown
Raw Normal View History

::: anchor
:::
2022-02-05 21:20:07 +00:00
::: title 基本介绍
:::
::: describe 用来代表用户或事物,支持图片、图标或字符展示。
:::
2021-10-25 17:13:23 +00:00
::: title 基础使用
2021-10-19 14:28:44 +00:00
:::
2022-02-01 15:26:28 +00:00
::: demo 使用 `lay-avatar` 标签, 创建头像
2021-10-01 12:22:49 +00:00
<template>
<lay-avatar :src="src"></lay-avatar>
2021-10-01 12:22:49 +00:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const src = ref("https://portrait.gitee.com/uploads/avatars/user/2813/8441097_shaynas_1610801433.png")
2021-10-01 12:22:49 +00:00
return {
src
2021-10-01 12:22:49 +00:00
}
}
}
</script>
:::
2021-10-25 17:13:23 +00:00
::: title 圆角头像
2021-10-19 14:28:44 +00:00
:::
2021-10-01 12:22:49 +00:00
::: demo
<template>
<lay-avatar :src="src" radius></lay-avatar>
2021-10-01 12:22:49 +00:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const src = "https://portrait.gitee.com/uploads/avatars/user/2813/8441097_shaynas_1610801433.png"
2021-10-01 12:22:49 +00:00
return {
src
2021-10-01 12:22:49 +00:00
}
}
}
</script>
:::
2021-10-25 17:13:23 +00:00
::: title 尺寸大小
2021-10-19 14:28:44 +00:00
:::
2021-10-01 12:22:49 +00:00
::: demo
<template>
<lay-avatar :src="src" size="xs"></lay-avatar>
2022-01-09 14:41:56 +00:00
&nbsp;&nbsp;
<lay-avatar :src="src" size="sm"></lay-avatar>
2022-01-09 14:41:56 +00:00
&nbsp;&nbsp;
<lay-avatar :src="src"></lay-avatar>
2022-01-09 14:41:56 +00:00
&nbsp;&nbsp;
<lay-avatar :src="src" size="lg"></lay-avatar>
2021-10-01 12:22:49 +00:00
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const src = "https://portrait.gitee.com/uploads/avatars/user/2813/8441097_shaynas_1610801433.png"
2021-10-01 12:22:49 +00:00
return {
2021-11-07 07:55:08 +00:00
src
2021-10-01 12:22:49 +00:00
}
}
}
</script>
2021-10-01 12:22:49 +00:00
:::
2022-01-09 14:41:56 +00:00
::: title 头像列表
:::
::: demo
<template>
<lay-avatar-list>
<lay-avatar :src="src" radius></lay-avatar>
<lay-avatar :src="src" radius></lay-avatar>
<lay-avatar :src="src" radius></lay-avatar>
<lay-avatar :src="src" radius></lay-avatar>
<lay-avatar :src="src" radius></lay-avatar>
</lay-avatar-list>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const src = "https://portrait.gitee.com/uploads/avatars/user/2813/8441097_shaynas_1610801433.png"
return {
src
}
}
}
</script>
:::
2022-01-09 17:17:03 +00:00
::: title Avatar 属性
:::
2021-10-12 10:00:09 +00:00
2021-11-07 07:55:08 +00:00
::: table
| 属性 | 描述 | 可选值 |
| ------ | ---- | -------------- |
| src | 图源 | -- |
| size | 尺寸 | `xs` `sm` `lg` |
| radius | 圆形 | `true` `false` |
2021-11-07 07:55:08 +00:00
2021-11-07 07:56:24 +00:00
:::
2021-12-16 09:57:59 +00:00
2022-03-29 23:44:37 +00:00
2022-01-12 06:22:53 +00:00
::: previousNext avatar
:::