feat(Rate): 当使用 readonly 和 allow-half 时支持 modelValue 设置小数 (#8528)

* feat(Rate): 当使用readonly和allow-half时支持modelValue设置小数

* docs(Rate): 完善文档

* docs(Rate): update snapshot

* docs(Rate): add description of decimal value

Co-authored-by: neverland <chenjiahan@buaa.edu.cn>
This commit is contained in:
nemo-shen
2021-04-18 20:36:48 +08:00
committed by GitHub
co-authored by neverland
parent 8e4e6d54a6
commit 8fb3560f39
6 changed files with 190 additions and 18 deletions
+9 -2
View File
@@ -39,8 +39,12 @@
<van-rate v-model="value6" readonly />
</demo-block>
<demo-block :title="t('readonlyHalfStar')">
<van-rate v-model="value7" readonly allow-half />
</demo-block>
<demo-block v-if="!isWeapp" :title="t('changeEvent')">
<van-rate v-model="value7" @change="onChange" />
<van-rate v-model="value8" @change="onChange" />
</demo-block>
</template>
@@ -57,6 +61,7 @@ const i18n = {
customStyle: '自定义样式',
customCount: '自定义数量',
readonly: '只读状态',
readonlyHalfStar: '只读状态小数显示',
changeEvent: '监听 change 事件',
toastContent: (value: number) => `当前值:${value}`,
},
@@ -67,6 +72,7 @@ const i18n = {
customStyle: 'Custom Style',
customCount: 'Custom Count',
readonly: 'Readonly',
readonlyHalfStar: 'Readonly Half Star',
changeEvent: 'Change Event',
toastContent: (value: number) => `current value${value}`,
},
@@ -82,7 +88,8 @@ export default {
value4: 2.5,
value5: 4,
value6: 3,
value7: 2,
value7: 3.3,
value8: 2,
});
const onChange = (value: number) => Toast(t('toastContent', value));