wxc-avatar
MinUI 小程序组件 - 头像
Install
$ min install @minui/wxc-avatar
Demos
消息提示
<template>
<wxc-avatar class="avatar" count="7" src="https://s11.mogucdn.com/p2/170413/upload_86dkh4e886991g9lji7a6g5c530ji_400x400.jpg"></wxc-avatar>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-avatar': '@minui/wxc-avatar'
}
},
data: {},
methods: {}
}
</script>
<style>
.avatar {
display: block;
width: 120rpx;
height: 120rpx;
}
</style>
默认姿势(圆形头像)
<template>
<wxc-avatar class="avatar" src="https://s11.mogucdn.com/p2/170413/upload_86dkh4e886991g9lji7a6g5c530ji_400x400.jpg"></wxc-avatar>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-avatar': '@minui/wxc-avatar'
}
},
data: {},
methods: {}
}
</script>
<style>
.avatar {
display: block;
width: 120rpx;
height: 120rpx;
}
</style>
方形头像
<template>
<wxc-avatar class="avatar" mold="square" src="https://s11.mogucdn.com/p2/170413/upload_86dkh4e886991g9lji7a6g5c530ji_400x400.jpg"></wxc-avatar>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-avatar': '@minui/wxc-avatar'
}
},
data: {},
methods: {}
}
</script>
<style>
.avatar {
display: block;
width: 120rpx;
height: 120rpx;
}
</style>
不同规格
<template>
<wxc-avatar class="avatar avatar__1" src="https://s11.mogucdn.com/p2/170413/upload_86dkh4e886991g9lji7a6g5c530ji_400x400.jpg"></wxc-avatar>
<wxc-avatar class="avatar avatar__2" src="https://s10.mogucdn.com/mlcdn/c45406/171116_3a30h33df8cj7f651al68hdh7bki7_528x528.png"></wxc-avatar>
<wxc-avatar class="avatar avatar__3" src="https://s10.mogucdn.com/mlcdn/c45406/171116_62f571l0ki0ffcg94h6kg6452h497_356x356.png"></wxc-avatar>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-avatar': '@minui/wxc-avatar'
}
},
data: {},
methods: {}
}
</script>
<style>
.avatar {
display: inline-block;
margin-right: 20rpx;
}
.avatar__1 {
width: 120rpx;
height: 120rpx;
}
.avatar__2 {
width: 160rpx;
height: 160rpx;
}
.avatar__3 {
width: 200rpx;
height: 200rpx;
}
</style>
自定义文字版
<template>
<wxc-avatar class="avatar">U</wxc-avatar>
</template>
<script>
export default {
config: {
usingComponents: {
'wxc-avatar': '@minui/wxc-avatar'
}
},
data: {},
methods: {}
}
</script>
<style>
.avatar {
display: block;
width: 120rpx;
height: 120rpx;
border-radius: 50%;
background: #31b0d5;
color: #FFF;
}
</style>
API
Avatar Props
名称 | 描述 |
---|---|
src | 头像图片地址 |
mold | 头像规格,circle(正圆)、square(正方),默认 circle |
count | 消息数,显示在头像右上角 |
Link
地址 | |
---|---|
avatar 组件文档 https://meili.github.io/min/docs/minui/index.html#avatar | |
avatar 组件源码 https://github.com/meili/minui/tree/master/packages/wxc-avatar | |
MinUI 组件库 https://github.com/meili/minui |
Preview
ChangeLog
v1.0.0(2017-11-16)
- 初始版本