From 246a12b466b3f15b1e6b7d8a97ba9cd2e901c45e Mon Sep 17 00:00:00 2001 From: liuxs <907478372@qq.com> Date: Thu, 5 Nov 2020 13:13:03 +0800 Subject: [PATCH] fix(rate): fix bugs,allow-half not correct #546 --- packages/rate/src/index.vue | 6 +++--- website/docs/zh-CN/rate.md | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/rate/src/index.vue b/packages/rate/src/index.vue index 4daafb2294..4014848f5e 100644 --- a/packages/rate/src/index.vue +++ b/packages/rate/src/index.vue @@ -192,9 +192,9 @@ export default defineComponent({ const classes = computed(() => { let result = Array(props.max) let threshold = currentValue.value - if (props.allowHalf && currentValue.value !== Math.floor(currentValue.value)) { - threshold-- - } + // if (props.allowHalf && currentValue.value !== Math.floor(currentValue.value)) { + // threshold-- + // } result.fill(activeClass.value, 0, threshold) result.fill(voidClass.value, threshold, props.max) return result diff --git a/website/docs/zh-CN/rate.md b/website/docs/zh-CN/rate.md index 471459da23..2ad1d6c4c3 100644 --- a/website/docs/zh-CN/rate.md +++ b/website/docs/zh-CN/rate.md @@ -32,6 +32,26 @@ ``` ::: +### 允许半选 +:::demo 为组件设置 `allow-half` 允许出现半星 +```html + +
+ +
+ + +``` +::: + ### 辅助文字 用辅助文字直接地表达对应分数