mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Form): support using rate
This commit is contained in:
parent
1db9536182
commit
1cde0b4d52
@ -9,6 +9,10 @@
|
||||
<van-switch v-model="switchChecked" slot="input" size="24" />
|
||||
</van-field>
|
||||
|
||||
<van-field name="rate" :label="$t('rate')">
|
||||
<van-rate v-model="rate" slot="input" />
|
||||
</van-field>
|
||||
|
||||
<div style="margin: 16px;">
|
||||
<van-button type="info" round block>{{ $t('submit') }}</van-button>
|
||||
</div>
|
||||
@ -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,
|
||||
};
|
||||
|
@ -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],
|
||||
|
Loading…
x
Reference in New Issue
Block a user