mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs(Form): use new unified syntax for perf
This commit is contained in:
parent
b8818cef8c
commit
d72bf8145a
@ -114,7 +114,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="switch" label="Switch">
|
||||
<van-switch v-model="switchChecked" slot="input" size="20" />
|
||||
<template #input>
|
||||
<van-switch v-model="switchChecked" size="20" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -132,17 +134,17 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="checkbox" label="Checkbox">
|
||||
<van-checkbox v-model="checkbox" slot="input" shape="square" />
|
||||
<template #input>
|
||||
<van-checkbox v-model="checkbox" shape="square" />
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field name="checkboxGroup" label="CheckboxGroup">
|
||||
<van-checkbox-group
|
||||
v-model="checkboxGroup"
|
||||
slot="input"
|
||||
direction="horizontal"
|
||||
>
|
||||
<template #input>
|
||||
<van-checkbox-group v-model="checkboxGroup" direction="horizontal">
|
||||
<van-checkbox name="1" shape="square">Checkbox 1</van-checkbox>
|
||||
<van-checkbox name="2" shape="square">Checkbox 2</van-checkbox>
|
||||
</van-checkbox-group>
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -161,10 +163,12 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="radio" label="Radio">
|
||||
<van-radio-group v-model="radio" direction="horizontal" slot="input">
|
||||
<template #input>
|
||||
<van-radio-group v-model="radio" direction="horizontal">
|
||||
<van-radio name="1">Radio 1</van-radio>
|
||||
<van-radio name="2">Radio 2</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -182,7 +186,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="stepper" label="Stepper">
|
||||
<van-stepper v-model="stepper" slot="input" />
|
||||
<template #input>
|
||||
<van-stepper v-model="stepper"/>
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -200,7 +206,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="rate" label="Rate">
|
||||
<van-rate v-model="rate" slot="input" />
|
||||
<template #input>
|
||||
<van-rate v-model="rate" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -218,7 +226,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="slider" label="Slider">
|
||||
<van-slider v-model="slider" slot="input" />
|
||||
<template #input>
|
||||
<van-slider v-model="slider" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -236,7 +246,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="uploader" label="Uploader">
|
||||
<van-uploader v-model="uploader" slot="input" />
|
||||
<template #input>
|
||||
<van-uploader v-model="uploader" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
|
@ -126,7 +126,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="switch" label="开关">
|
||||
<van-switch v-model="switchChecked" slot="input" size="20" />
|
||||
<template #input>
|
||||
<van-switch v-model="switchChecked" size="20" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -146,17 +148,17 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="checkbox" label="复选框">
|
||||
<van-checkbox v-model="checkbox" slot="input" shape="square" />
|
||||
<template #input>
|
||||
<van-checkbox v-model="checkbox" shape="square" />
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field name="checkboxGroup" label="复选框组">
|
||||
<van-checkbox-group
|
||||
v-model="checkboxGroup"
|
||||
slot="input"
|
||||
direction="horizontal"
|
||||
>
|
||||
<template #input>
|
||||
<van-checkbox-group v-model="checkboxGroup" direction="horizontal">
|
||||
<van-checkbox name="1" shape="square">复选框 1</van-checkbox>
|
||||
<van-checkbox name="2" shape="square">复选框 2</van-checkbox>
|
||||
</van-checkbox-group>
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -177,10 +179,12 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="radio" label="单选框">
|
||||
<van-radio-group v-model="radio" direction="horizontal" slot="input">
|
||||
<template #input>
|
||||
<van-radio-group v-model="radio" direction="horizontal">
|
||||
<van-radio name="1">单选框 1</van-radio>
|
||||
<van-radio name="2">单选框 2</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -200,7 +204,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="stepper" label="步进器">
|
||||
<van-stepper v-model="stepper" slot="input" />
|
||||
<template #input>
|
||||
<van-stepper v-model="stepper" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -220,7 +226,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="rate" label="评分">
|
||||
<van-rate v-model="rate" slot="input" />
|
||||
<template #input>
|
||||
<van-rate v-model="rate" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -240,7 +248,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="slider" label="滑块">
|
||||
<van-slider v-model="slider" slot="input" />
|
||||
<template #input>
|
||||
<van-slider v-model="slider" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
@ -260,7 +270,9 @@ export default {
|
||||
|
||||
```html
|
||||
<van-field name="uploader" label="文件上传">
|
||||
<van-uploader v-model="uploader" slot="input" />
|
||||
<template #input>
|
||||
<van-uploader v-model="uploader" />
|
||||
</template>
|
||||
</van-field>
|
||||
```
|
||||
|
||||
|
@ -2,19 +2,20 @@
|
||||
<demo-block :title="$t('fieldType')">
|
||||
<van-form @submit="onSubmit">
|
||||
<van-field name="switch" :label="$t('switch')">
|
||||
<van-switch v-model="switchChecked" slot="input" size="20" />
|
||||
<template #input>
|
||||
<van-switch v-model="switchChecked" size="20" />
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="checkbox" :label="$t('checkbox')">
|
||||
<van-checkbox v-model="checkbox" slot="input" shape="square" />
|
||||
<template #input>
|
||||
<van-checkbox v-model="checkbox" shape="square" />
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="checkboxGroup" :label="$t('checkboxGroup')">
|
||||
<van-checkbox-group
|
||||
v-model="checkboxGroup"
|
||||
slot="input"
|
||||
direction="horizontal"
|
||||
>
|
||||
<template #input>
|
||||
<van-checkbox-group v-model="checkboxGroup" direction="horizontal">
|
||||
<van-checkbox name="1" shape="square">
|
||||
{{ $t('checkbox') }} 1
|
||||
</van-checkbox>
|
||||
@ -22,29 +23,40 @@
|
||||
{{ $t('checkbox') }} 2
|
||||
</van-checkbox>
|
||||
</van-checkbox-group>
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="radio" :label="$t('radio')">
|
||||
<van-radio-group v-model="radio" direction="horizontal" slot="input">
|
||||
<template #input>
|
||||
<van-radio-group v-model="radio" direction="horizontal">
|
||||
<van-radio name="1">{{ $t('radio') }} 1</van-radio>
|
||||
<van-radio name="2">{{ $t('radio') }} 2</van-radio>
|
||||
</van-radio-group>
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="stepper" :label="$t('stepper')">
|
||||
<van-stepper v-model="stepper" slot="input" />
|
||||
<template #input>
|
||||
<van-stepper v-model="stepper" />
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="rate" :label="$t('rate')">
|
||||
<van-rate v-model="rate" slot="input" />
|
||||
<template #input>
|
||||
<van-rate v-model="rate" />
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="slider" :label="$t('slider')">
|
||||
<van-slider v-model="slider" slot="input" />
|
||||
<template #input>
|
||||
<van-slider v-model="slider" />
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<van-field name="uploader" :label="$t('uploader')">
|
||||
<van-uploader v-model="uploader" slot="input" max-count="2" />
|
||||
<template #input>
|
||||
<van-uploader v-model="uploader" max-count="2" />
|
||||
</template>
|
||||
</van-field>
|
||||
|
||||
<field-type-picker />
|
||||
|
@ -150,7 +150,9 @@ test('input-align prop', () => {
|
||||
<van-form input-align="right">
|
||||
<van-field />
|
||||
<van-field>
|
||||
<div slot="input" />
|
||||
<template #input>
|
||||
<div />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-form>
|
||||
`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user