mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Form): add label-align prop
This commit is contained in:
parent
fbe3d20558
commit
f1e25123a3
@ -433,10 +433,19 @@ export default createComponent({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getProp(key) {
|
||||||
|
if (this.vanForm && isDef(this.vanForm[key])) {
|
||||||
|
return this.vanForm[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
return this[key];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { slots, labelAlign } = this;
|
const { slots } = this;
|
||||||
|
const labelAlign = this.getProp('labelAlign');
|
||||||
|
|
||||||
const scopedSlots = {
|
const scopedSlots = {
|
||||||
icon: this.genLeftIcon,
|
icon: this.genLeftIcon,
|
||||||
|
@ -405,6 +405,7 @@ export default {
|
|||||||
|
|
||||||
| Attribute | Description | Type | Default |
|
| Attribute | Description | Type | Default |
|
||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
|
| label-align | Label text align, can be set to `center` `right` | *string* | `left` |
|
||||||
| validate-first | Whether to stop the validation when a rule fails | *boolean* | `false` |
|
| validate-first | Whether to stop the validation when a rule fails | *boolean* | `false` |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
@ -437,6 +437,7 @@ export default {
|
|||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
|
| label-align | 表单项左侧文本对齐方式,可选值为 `center` `right` | *string* | `left` |
|
||||||
| validate-first | 是否在某一项校验不通过时停止校验 | *boolean* | `false` |
|
| validate-first | 是否在某一项校验不通过时停止校验 | *boolean* | `false` |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
@ -4,6 +4,7 @@ const [createComponent, bem] = createNamespace('form');
|
|||||||
|
|
||||||
export default createComponent({
|
export default createComponent({
|
||||||
props: {
|
props: {
|
||||||
|
labelAlign: String,
|
||||||
validateFirst: Boolean,
|
validateFirst: Boolean,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user