mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-09 02:31:33 +08:00
fix(rate): fix bugs,allow-half not correct #546
This commit is contained in:
parent
ee744e2925
commit
246a12b466
@ -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
|
||||
|
@ -32,6 +32,26 @@
|
||||
```
|
||||
:::
|
||||
|
||||
### 允许半选
|
||||
:::demo 为组件设置 `allow-half` 允许出现半星
|
||||
```html
|
||||
|
||||
<div class="block">
|
||||
<el-rate v-model="value" allow-half />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
```
|
||||
:::
|
||||
|
||||
### 辅助文字
|
||||
|
||||
用辅助文字直接地表达对应分数
|
||||
|
Loading…
Reference in New Issue
Block a user