mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-02 12:18:46 +08:00
Form: fix label style (#14969)
This commit is contained in:
parent
7eacbbeb2e
commit
7b24f82586
@ -56,6 +56,7 @@
|
||||
},
|
||||
computed: {
|
||||
autoLabelWidth() {
|
||||
if (!this.potentialLabelWidthArr.length) return 0;
|
||||
const max = Math.max(...this.potentialLabelWidthArr);
|
||||
return max ? `${max}px` : '';
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ export default {
|
||||
const autoLabelWidth = this.elForm.autoLabelWidth;
|
||||
const style = {};
|
||||
if (autoLabelWidth && autoLabelWidth !== 'auto') {
|
||||
style.width = autoLabelWidth;
|
||||
const marginLeft = parseInt(autoLabelWidth, 10) - this.computedWidth;
|
||||
if (marginLeft) {
|
||||
style.marginLeft = marginLeft + 'px';
|
||||
}
|
||||
}
|
||||
return (<div class="el-form-item__label-wrap" style={style}>
|
||||
{ slots }
|
||||
@ -64,10 +67,9 @@ export default {
|
||||
this.updateLabelWidth('update');
|
||||
},
|
||||
|
||||
// Is this necessary?
|
||||
// updated() {
|
||||
// this.updateLabelWidth('update');
|
||||
// },
|
||||
updated() {
|
||||
this.updateLabelWidth('update');
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
this.updateLabelWidth('remove');
|
||||
|
@ -86,7 +86,6 @@
|
||||
|
||||
@include e(label-wrap) {
|
||||
float: left;
|
||||
text-align: right;
|
||||
.el-form-item__label {
|
||||
display: inline-block;
|
||||
float: none;
|
||||
|
Loading…
Reference in New Issue
Block a user