网站制作推荐新鸿儒,黄山游玩攻略及费用,汽车之家网站是怎么做的,网站 流量攻击怎么办本组件一般用于展示头像的地方#xff0c;如个人中心#xff0c;或者评论列表页的用户头像展示等场所。
#平台差异说明
App#xff08;vue#xff09;App#xff08;nvue#xff09;H5小程序√√√√
#基本使用
通过src指定头像的路径即可简单使用#xff0c;如果传…本组件一般用于展示头像的地方如个人中心或者评论列表页的用户头像展示等场所。
#平台差异说明
AppvueAppnvueH5小程序√√√√
#基本使用
通过src指定头像的路径即可简单使用如果传递了text参数text将会优先起作用
注意 请保证传递给src的是绝对地址而不是相对地址为什么呢因为传入avatar组件的相对地址是相对于组件的而不是父组件(页面)所以相对址可能会出错。
templateviewu-avatar :srcsrc/u-avataru-avatar :texttext/u-avatar/view
/templatescriptexport default {data() {return {src: http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg,text: 无头像}}}
/scriptcopy
#头像形状
shape参数指定头像的形状取值circle为圆形取值square为圆角方形
templateu-avatar :srcsrc shapesquare/u-avatar
/templatescriptexport default {data() {return {src: http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg}}}
/scriptcopy
#图标头像
icon参数指定头像的图标图标可参考icon组件
view classu-demo-block__contentview classu-avatar-itemu-avatariconred-packet-fillfontSize22/u-avatar/viewview classu-avatar-itemu-avatariconstar-fillfontSize22/u-avatar/view
/viewstyle langscss.u-demo-block__content {include flex;align-items: center;}.u-avatar-item {margin-right: 30px;}
/stylecopy
#文字头像自动背景色
randomBgColor参数开启头像的自动背景色
templateu-avatartext北fontSize18randomBgColor/u-avatar
/templatecopy
#默认头像
如果头像加载失败导致加载图片失败将会显示一个默认的灰色头像
#头像组
使用u-avatar-group实现头像组
templateu-avatar-group:urlsurlssize35gap0.4/u-avatar-group
/templatescriptexport default {data() {return {urls: [https://cdn.uviewui.com/uview/album/1.jpg,https://cdn.uviewui.com/uview/album/2.jpg,https://cdn.uviewui.com/uview/album/3.jpg,https://cdn.uviewui.com/uview/album/4.jpg,https://cdn.uviewui.com/uview/album/7.jpg,https://cdn.uviewui.com/uview/album/6.jpg,https://cdn.uviewui.com/uview/album/5.jpg]}}
/script