feat(Form): support using stepper

This commit is contained in:
陈嘉涵 2020-02-10 17:06:00 +08:00
parent 1cde0b4d52
commit 7fa4e8cad1
2 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,10 @@
<van-rate v-model="rate" slot="input" /> <van-rate v-model="rate" slot="input" />
</van-field> </van-field>
<van-field name="stepper" :label="$t('stepper')">
<van-stepper v-model="stepper" slot="input" />
</van-field>
<div style="margin: 16px;"> <div style="margin: 16px;">
<van-button type="info" round block>{{ $t('submit') }}</van-button> <van-button type="info" round block>{{ $t('submit') }}</van-button>
</div> </div>
@ -27,6 +31,7 @@ export default {
rate: '评分', rate: '评分',
submit: '提交', submit: '提交',
switch: '开关', switch: '开关',
stepper: '步进器',
checkbox: '复选框', checkbox: '复选框',
fieldType: '表单项类型', fieldType: '表单项类型',
requireCheckbox: '请勾选复选框', requireCheckbox: '请勾选复选框',
@ -35,6 +40,7 @@ export default {
rate: 'Rate', rate: 'Rate',
submit: 'Submit', submit: 'Submit',
switch: 'Switch', switch: 'Switch',
stepper: 'Stepper',
checkbox: 'Checkbox', checkbox: 'Checkbox',
fieldType: 'Field Type', fieldType: 'Field Type',
requireCheckbox: 'Checkbox is required', requireCheckbox: 'Checkbox is required',
@ -44,6 +50,7 @@ export default {
data() { data() {
return { return {
rate: 3, rate: 3,
stepper: 1,
checkbox: false, checkbox: false,
switchChecked: false, switchChecked: false,
}; };

View File

@ -1,6 +1,7 @@
import { createNamespace, isDef, addUnit } from '../utils'; import { createNamespace, isDef, addUnit } from '../utils';
import { resetScroll } from '../utils/dom/reset-scroll'; import { resetScroll } from '../utils/dom/reset-scroll';
import { preventDefault } from '../utils/dom/event'; import { preventDefault } from '../utils/dom/event';
import { FieldMixin } from '../mixins/field';
const [createComponent, bem] = createNamespace('stepper'); const [createComponent, bem] = createNamespace('stepper');
@ -18,6 +19,8 @@ function add(num1, num2) {
} }
export default createComponent({ export default createComponent({
mixins: [FieldMixin],
props: { props: {
value: null, value: null,
integer: Boolean, integer: Boolean,