综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

props.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import { range } from '@/uni_modules/uv-ui-tools/libs/function/test.js'
  2. export default {
  3. props: {
  4. // 头像图片路径(不能为相对路径)
  5. src: {
  6. type: String,
  7. default: ''
  8. },
  9. // 头像形状,circle-圆形,square-方形
  10. shape: {
  11. type: String,
  12. default: 'circle'
  13. },
  14. // 头像尺寸
  15. size: {
  16. type: [String, Number],
  17. default: 40
  18. },
  19. // 裁剪模式
  20. mode: {
  21. type: String,
  22. default: 'scaleToFill'
  23. },
  24. // 显示的文字
  25. text: {
  26. type: String,
  27. default: ''
  28. },
  29. // 背景色
  30. bgColor: {
  31. type: String,
  32. default: '#c0c4cc'
  33. },
  34. // 文字颜色
  35. color: {
  36. type: String,
  37. default: '#fff'
  38. },
  39. // 文字大小
  40. fontSize: {
  41. type: [String, Number],
  42. default: 18
  43. },
  44. // 显示的图标
  45. icon: {
  46. type: String,
  47. default: ''
  48. },
  49. // 显示小程序头像,只对百度,微信,QQ小程序有效
  50. mpAvatar: {
  51. type: Boolean,
  52. default: false
  53. },
  54. // 是否使用随机背景色
  55. randomBgColor: {
  56. type: Boolean,
  57. default: false
  58. },
  59. // 加载失败的默认头像(组件有内置默认图片)
  60. defaultUrl: {
  61. type: String,
  62. default: ''
  63. },
  64. // 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间
  65. colorIndex: {
  66. type: [String, Number],
  67. // 校验参数规则,索引在0-19之间
  68. validator(n) {
  69. return range(n, [0, 19]) || n === ''
  70. },
  71. default: ''
  72. },
  73. // 组件标识符
  74. name: {
  75. type: String,
  76. default: ''
  77. },
  78. ...uni.$uv?.props?.avatar
  79. }
  80. }