component.scheme.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import { StarFilled } from '@element-plus/icons-vue'
  2. export const propsScheme = {
  3. modelValue: {
  4. type: Number,
  5. default: 0,
  6. intro: '选中项绑定值'
  7. },
  8. max: {
  9. type: Number,
  10. default: 5,
  11. intro: '最大分值'
  12. },
  13. size: {
  14. type: String,
  15. default: 'default',
  16. intro: '尺寸',
  17. options: ['small', 'default', 'large'],
  18. validate: true
  19. },
  20. disabled: {
  21. type: Boolean,
  22. default: false,
  23. intro: '是否为只读'
  24. },
  25. allowHalf: {
  26. type: Boolean,
  27. default: false,
  28. intro: '是否允许半选'
  29. },
  30. lowThreshold: {
  31. type: Number,
  32. default: 2,
  33. intro: '低分和中等分数的界限值, 值本身被划分在低分中'
  34. },
  35. highThreshold: {
  36. type: Number,
  37. default: 4,
  38. intro: '高分和中等分数的界限值, 值本身被划分在高分中'
  39. },
  40. colors: {
  41. type: [Array, Object],
  42. default: () => ['#FF8F33', '#FF8F33', '#FF8F33'],
  43. intro: 'icon 的颜色。 若传入数组,共有 3 个元素,为 3 个分段所对应的颜色;若传入对象,可自定义分段,键名为分段的界限值,键值为对应的颜色'
  44. },
  45. voidColor: {
  46. type: String,
  47. default: '#F0F2F5',
  48. intro: '未选中 icon 的颜色'
  49. },
  50. disabledVoidColor: {
  51. type: String,
  52. default: '#EFF2F7',
  53. intro: '只读时未选中 icon 的颜色'
  54. },
  55. icons: {
  56. type: [Array, Object],
  57. default: () => [StarFilled, StarFilled, StarFilled],
  58. intro: '图标组件 若传入数组,共有 3 个元素,为 3 个分段所对应的类名;若传入对象,可自定义分段,键名为分段的界限值,键值为对应的类名'
  59. },
  60. voidIcon: {
  61. type: [String, Object],
  62. default: StarFilled,
  63. intro: '未被选中的图标组件'
  64. },
  65. disabledVoidIcon: {
  66. type: [String, Object],
  67. default: StarFilled,
  68. intro: '禁用状态的未选择图标'
  69. },
  70. showText: {
  71. type: Boolean,
  72. default: false,
  73. intro: '是否显示辅助文字,若为真,则会从 texts 数组中选取当前分数对应的文字内容'
  74. },
  75. showScore: {
  76. type: Boolean,
  77. default: false,
  78. intro: '是否显示当前分数, show-score 和 show-text 不能同时为真'
  79. },
  80. textColor: {
  81. type: String,
  82. default: '#1F2D3D',
  83. intro: '辅助文字的颜色'
  84. },
  85. texts: {
  86. type: Array,
  87. default: () => ['Extremely bad', 'Disappointed', 'Fair', 'Satisfied', 'Surprise'],
  88. intro: '辅助文字数组'
  89. },
  90. scoreTemplate: {
  91. type: String,
  92. intro: '分数显示模板'
  93. }
  94. }
  95. export const eventsScheme = {
  96. 'update:modelValue': {
  97. cbVar: 'val'
  98. },
  99. change: {
  100. cbVar: 'val',
  101. intro: '分值改变时触发'
  102. }
  103. }
  104. export const componentScheme = {
  105. propsScheme,
  106. eventsScheme
  107. }