mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-24 18:36:51 +08:00
[improvement] Field: optimize label width
This commit is contained in:
parent
3fbd94f345
commit
dd32efd5a4
@ -67,10 +67,7 @@ export default sfc({
|
|||||||
const { labelWidth } = this;
|
const { labelWidth } = this;
|
||||||
if (labelWidth) {
|
if (labelWidth) {
|
||||||
const width = isNumber(String(labelWidth)) ? `${labelWidth}px` : labelWidth;
|
const width = isNumber(String(labelWidth)) ? `${labelWidth}px` : labelWidth;
|
||||||
return {
|
return { width };
|
||||||
maxWidth: width,
|
|
||||||
minWidth: width
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
.van-field {
|
.van-field {
|
||||||
&__label {
|
&__label {
|
||||||
max-width: @field-label-max-width;
|
flex: none;
|
||||||
|
width: @field-label-width;
|
||||||
|
|
||||||
&--center {
|
&--center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -19,7 +19,7 @@ exports[`clearable 2`] = `
|
|||||||
|
|
||||||
exports[`label-width prop with unit 1`] = `
|
exports[`label-width prop with unit 1`] = `
|
||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label" style="max-width: 10rem; min-width: 10rem;"><span>Label</span></div>
|
<div class="van-cell__title van-field__label" style="width: 10rem;"><span>Label</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="text" class="van-field__control"></div>
|
<div class="van-field__body"><input type="text" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -28,7 +28,7 @@ exports[`label-width prop with unit 1`] = `
|
|||||||
|
|
||||||
exports[`label-width prop without unit 1`] = `
|
exports[`label-width prop without unit 1`] = `
|
||||||
<div class="van-cell van-field">
|
<div class="van-cell van-field">
|
||||||
<div class="van-cell__title van-field__label" style="max-width: 100px; min-width: 100px;"><span>Label</span></div>
|
<div class="van-cell__title van-field__label" style="width: 100px;"><span>Label</span></div>
|
||||||
<div class="van-cell__value">
|
<div class="van-cell__value">
|
||||||
<div class="van-field__body"><input type="text" class="van-field__control"></div>
|
<div class="van-field__body"><input type="text" class="van-field__control"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -150,7 +150,7 @@
|
|||||||
@dialog-confirm-button-text-color: @blue;
|
@dialog-confirm-button-text-color: @blue;
|
||||||
|
|
||||||
// Field
|
// Field
|
||||||
@field-label-max-width: 90px;
|
@field-label-width: 90px;
|
||||||
@field-input-text-color: @text-color;
|
@field-input-text-color: @text-color;
|
||||||
@field-input-error-text-color: @red;
|
@field-input-error-text-color: @red;
|
||||||
@field-input-disabled-text-color: @gray-dark;
|
@field-input-disabled-text-color: @gray-dark;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user