mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
docs(Field): consistent with demo (#11707)
This commit is contained in:
parent
1c1e2e3b27
commit
81d36aa9ac
@ -6,6 +6,7 @@
|
|||||||
"lint": "pnpm --dir ./packages/vant lint",
|
"lint": "pnpm --dir ./packages/vant lint",
|
||||||
"test": "pnpm --dir ./packages/vant test",
|
"test": "pnpm --dir ./packages/vant test",
|
||||||
"test:watch": "pnpm --dir ./packages/vant test:watch",
|
"test:watch": "pnpm --dir ./packages/vant test:watch",
|
||||||
|
"test:update": "pnpm --dir ./packages/vant test:update",
|
||||||
"build": "pnpm --dir ./packages/vant build",
|
"build": "pnpm --dir ./packages/vant build",
|
||||||
"build:site": "pnpm --dir ./packages/vant build:site"
|
"build:site": "pnpm --dir ./packages/vant build:site"
|
||||||
},
|
},
|
||||||
|
@ -243,16 +243,34 @@ Use `input-align` prop to align the input value.
|
|||||||
|
|
||||||
### Label Align
|
### Label Align
|
||||||
|
|
||||||
Use `label-align` prop to align the input value.
|
Use `label-align` prop to align the input value, can be set to `center`, `right` or `top`.
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<van-cell-group inset>
|
<van-cell-group inset>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="value"
|
v-model="value"
|
||||||
label="Tel"
|
label="Label"
|
||||||
placeholder="Please input tel number"
|
placeholder="Align Top"
|
||||||
label-align="top"
|
label-align="top"
|
||||||
/>
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="value2"
|
||||||
|
label="Label"
|
||||||
|
placeholder="Align Left"
|
||||||
|
label-align="left"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="value3"
|
||||||
|
label="Label"
|
||||||
|
placeholder="Align Center"
|
||||||
|
label-align="center"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="value4"
|
||||||
|
label="Label"
|
||||||
|
placeholder="Align Right"
|
||||||
|
label-align="right"
|
||||||
|
/>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -268,10 +268,28 @@ export default {
|
|||||||
<van-cell-group inset>
|
<van-cell-group inset>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="value"
|
v-model="value"
|
||||||
label="手机号"
|
label="文本"
|
||||||
placeholder="请输入手机号"
|
placeholder="顶部对齐"
|
||||||
label-align="top"
|
label-align="top"
|
||||||
/>
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="value2"
|
||||||
|
label="文本"
|
||||||
|
placeholder="左对齐"
|
||||||
|
label-align="left"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="value3"
|
||||||
|
label="文本"
|
||||||
|
placeholder="居中对齐"
|
||||||
|
label-align="center"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="value4"
|
||||||
|
label="文本"
|
||||||
|
placeholder="右对齐"
|
||||||
|
label-align="right"
|
||||||
|
/>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import { useTranslate } from '../../../docs/site';
|
|||||||
|
|
||||||
const t = useTranslate({
|
const t = useTranslate({
|
||||||
'zh-CN': {
|
'zh-CN': {
|
||||||
text: '文本',
|
label: '文本',
|
||||||
top: '顶部对齐',
|
top: '顶部对齐',
|
||||||
center: '居中对齐',
|
center: '居中对齐',
|
||||||
left: '左对齐',
|
left: '左对齐',
|
||||||
@ -14,11 +14,11 @@ const t = useTranslate({
|
|||||||
labelAlign: '输入框文本位置',
|
labelAlign: '输入框文本位置',
|
||||||
},
|
},
|
||||||
'en-US': {
|
'en-US': {
|
||||||
text: 'Text',
|
label: 'Label',
|
||||||
top: 'Top Align',
|
top: 'Align Top',
|
||||||
center: 'Center Align',
|
center: 'Align Center',
|
||||||
left: 'Left Align',
|
left: 'Align Left',
|
||||||
right: 'Right Align',
|
right: 'Align Right',
|
||||||
labelAlign: 'Label Align',
|
labelAlign: 'Label Align',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -31,25 +31,25 @@ const value = ref('');
|
|||||||
<van-cell-group inset>
|
<van-cell-group inset>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:label="t('text')"
|
:label="t('label')"
|
||||||
:placeholder="t('top')"
|
:placeholder="t('top')"
|
||||||
label-align="top"
|
label-align="top"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:label="t('text')"
|
:label="t('label')"
|
||||||
:placeholder="t('left')"
|
:placeholder="t('left')"
|
||||||
label-align="left"
|
label-align="left"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:label="t('text')"
|
:label="t('label')"
|
||||||
:placeholder="t('center')"
|
:placeholder="t('center')"
|
||||||
label-align="center"
|
label-align="center"
|
||||||
/>
|
/>
|
||||||
<van-field
|
<van-field
|
||||||
v-model="value"
|
v-model="value"
|
||||||
:label="t('text')"
|
:label="t('label')"
|
||||||
:placeholder="t('right')"
|
:placeholder="t('right')"
|
||||||
label-align="right"
|
label-align="right"
|
||||||
/>
|
/>
|
||||||
|
@ -424,7 +424,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<label id="van-field-label"
|
<label id="van-field-label"
|
||||||
for="van-field-input"
|
for="van-field-input"
|
||||||
>
|
>
|
||||||
Text
|
Label
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell__value van-field__value">
|
<div class="van-cell__value van-field__value">
|
||||||
@ -432,7 +432,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
id="van-field-input"
|
id="van-field-input"
|
||||||
class="van-field__control"
|
class="van-field__control"
|
||||||
placeholder="Top Align"
|
placeholder="Align Top"
|
||||||
aria-labelledby="van-field-label"
|
aria-labelledby="van-field-label"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -443,7 +443,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<label id="van-field-label"
|
<label id="van-field-label"
|
||||||
for="van-field-input"
|
for="van-field-input"
|
||||||
>
|
>
|
||||||
Text
|
Label
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell__value van-field__value">
|
<div class="van-cell__value van-field__value">
|
||||||
@ -451,7 +451,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
id="van-field-input"
|
id="van-field-input"
|
||||||
class="van-field__control"
|
class="van-field__control"
|
||||||
placeholder="Left Align"
|
placeholder="Align Left"
|
||||||
aria-labelledby="van-field-label"
|
aria-labelledby="van-field-label"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -462,7 +462,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<label id="van-field-label"
|
<label id="van-field-label"
|
||||||
for="van-field-input"
|
for="van-field-input"
|
||||||
>
|
>
|
||||||
Text
|
Label
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell__value van-field__value">
|
<div class="van-cell__value van-field__value">
|
||||||
@ -470,7 +470,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
id="van-field-input"
|
id="van-field-input"
|
||||||
class="van-field__control"
|
class="van-field__control"
|
||||||
placeholder="Center Align"
|
placeholder="Align Center"
|
||||||
aria-labelledby="van-field-label"
|
aria-labelledby="van-field-label"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -481,7 +481,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<label id="van-field-label"
|
<label id="van-field-label"
|
||||||
for="van-field-input"
|
for="van-field-input"
|
||||||
>
|
>
|
||||||
Text
|
Label
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="van-cell__value van-field__value">
|
<div class="van-cell__value van-field__value">
|
||||||
@ -489,7 +489,7 @@ exports[`should render demo and match snapshot 1`] = `
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
id="van-field-input"
|
id="van-field-input"
|
||||||
class="van-field__control"
|
class="van-field__control"
|
||||||
placeholder="Right Align"
|
placeholder="Align Right"
|
||||||
aria-labelledby="van-field-label"
|
aria-labelledby="van-field-label"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user