♻️(component): rate组件 has-clear改为allow-clear

This commit is contained in:
0o张不歪o0 2022-07-18 14:34:39 +08:00
parent d2f11c1866
commit 67d41b413d
2 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@ export interface LayRateProps {
half?: boolean; half?: boolean;
text?: boolean; text?: boolean;
isBlock?: boolean; isBlock?: boolean;
hasClear?: boolean; allowClear?: boolean;
clearIcon?: string; clearIcon?: string;
icons?: string[]; icons?: string[];
} }
@ -28,7 +28,7 @@ const props = withDefaults(defineProps<LayRateProps>(), {
half: false, half: false,
text: false, text: false,
isBlock: false, isBlock: false,
hasClear: false, allowClear: false,
clearIcon: "layui-icon-close-fill", clearIcon: "layui-icon-close-fill",
icons: () => [ icons: () => [
"layui-icon-rate", "layui-icon-rate",
@ -83,7 +83,7 @@ const action = function (index: number, event: any) {
}; };
// //
const showClearIcon = computed(() => !props.readonly && props.hasClear); const showClearIcon = computed(() => !props.readonly && props.allowClear);
const clearRate = function () { const clearRate = function () {
tempValue.value = 0; tempValue.value = 0;
currentValue.value = 0; currentValue.value = 0;

View File

@ -95,7 +95,7 @@ export default {
::: demo ::: demo
<template> <template>
<lay-rate v-model="clearHalf" :half="true" :is-block="true" has-clear></lay-rate> <lay-rate v-model="clearHalf" :half="true" :is-block="true" allow-clear></lay-rate>
</template> </template>
<script> <script>
@ -313,7 +313,7 @@ export default {
| half | 设定组件是否可以选择半星 | `boolean` | false | | half | 设定组件是否可以选择半星 | `boolean` | false |
| text | 是否显示评分对应的内容 | `boolean` | false | | text | 是否显示评分对应的内容 | `boolean` | false |
| is-block | 评分是否显示为快元素 | `boolean` | false | | is-block | 评分是否显示为快元素 | `boolean` | false |
| has-clear | 评分是否需要清除功能 | `boolean` | false | | allow-clear | 评分是否需要清除功能 | `boolean` | false |
| clear-icon | 评分清除功能使用的图标`class` | `string` | `layui-icon-close-fill` | | clear-icon | 评分清除功能使用的图标`class` | `string` | `layui-icon-close-fill` |
| icons | 评分使用图标`class``["空心", "实心"]`/`["空心", "半心", "实心"]` | `string[]` | 星型 | | icons | 评分使用图标`class``["空心", "实心"]`/`["空心", "半心", "实心"]` | `string[]` | 星型 |