From 1cde0b4d52430a77fb7a976e4014ca77288b690b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Mon, 10 Feb 2020 17:01:56 +0800 Subject: [PATCH] feat(Form): support using rate --- src/form/demo/FieldType.vue | 7 +++++++ src/rate/index.js | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/form/demo/FieldType.vue b/src/form/demo/FieldType.vue index 0b3d89d92..4daac1680 100644 --- a/src/form/demo/FieldType.vue +++ b/src/form/demo/FieldType.vue @@ -9,6 +9,10 @@ + + + +
{{ $t('submit') }}
@@ -20,6 +24,7 @@ export default { i18n: { 'zh-CN': { + rate: '评分', submit: '提交', switch: '开关', checkbox: '复选框', @@ -27,6 +32,7 @@ export default { requireCheckbox: '请勾选复选框', }, 'en-US': { + rate: 'Rate', submit: 'Submit', switch: 'Switch', checkbox: 'Checkbox', @@ -37,6 +43,7 @@ export default { data() { return { + rate: 3, checkbox: false, switchChecked: false, }; diff --git a/src/rate/index.js b/src/rate/index.js index b107f26aa..a0ae252ba 100644 --- a/src/rate/index.js +++ b/src/rate/index.js @@ -1,6 +1,12 @@ +// Utils import { createNamespace, addUnit } from '../utils'; import { preventDefault } from '../utils/dom/event'; + +// Mixins import { TouchMixin } from '../mixins/touch'; +import { FieldMixin } from '../mixins/field'; + +// Components import Icon from '../icon'; const [createComponent, bem] = createNamespace('rate'); @@ -18,7 +24,7 @@ function getRateStatus(value, index, allowHalf) { } export default createComponent({ - mixins: [TouchMixin], + mixins: [TouchMixin, FieldMixin], props: { size: [Number, String],