cultivationApp/node_modules/uview-plus/components/u-avatar/props.js

80 lines
2.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import defprops from '../../libs/config/props';
export default {
props: {
// 头像图片路径(不能为相对路径)
src: {
type: String,
default: defprops.avatar.src
},
// 头像形状circle-圆形square-方形
shape: {
type: String,
default: defprops.avatar.shape
},
// 头像尺寸
size: {
type: [String, Number],
default: defprops.avatar.size
},
// 裁剪模式
mode: {
type: String,
default: defprops.avatar.mode
},
// 显示的文字
text: {
type: String,
default: defprops.avatar.text
},
// 背景色
bgColor: {
type: String,
default: defprops.avatar.bgColor
},
// 文字颜色
color: {
type: String,
default: defprops.avatar.color
},
// 文字大小
fontSize: {
type: [String, Number],
default: defprops.avatar.fontSize
},
// 显示的图标
icon: {
type: String,
default: defprops.avatar.icon
},
// 显示小程序头像只对百度微信QQ小程序有效
mpAvatar: {
type: Boolean,
default: defprops.avatar.mpAvatar
},
// 是否使用随机背景色
randomBgColor: {
type: Boolean,
default: defprops.avatar.randomBgColor
},
// 加载失败的默认头像(组件有内置默认图片)
defaultUrl: {
type: String,
default: defprops.avatar.defaultUrl
},
// 如果配置了randomBgColor为true且配置了此值则从默认的背景色数组中取出对应索引的颜色值取值0-19之间
colorIndex: {
type: [String, Number],
// 校验参数规则索引在0-19之间
validator(n) {
return uni.$u.test.range(n, [0, 19]) || n === ''
},
default: defprops.avatar.colorIndex
},
// 组件标识符
name: {
type: String,
default: defprops.avatar.name
}
}
}