mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Field): incorrect count of line break in safari (#5049)
This commit is contained in:
parent
f8c130d0cb
commit
1c03d5d3f3
@ -2,10 +2,7 @@
|
|||||||
<demo-section>
|
<demo-section>
|
||||||
<demo-block :title="$t('basicUsage')">
|
<demo-block :title="$t('basicUsage')">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-field
|
<van-field v-model="value" :placeholder="$t('usernamePlaceholder')" />
|
||||||
v-model="value"
|
|
||||||
:placeholder="$t('usernamePlaceholder')"
|
|
||||||
/>
|
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
@ -69,10 +66,7 @@
|
|||||||
:placeholder="$t('smsPlaceholder')"
|
:placeholder="$t('smsPlaceholder')"
|
||||||
>
|
>
|
||||||
<template #button>
|
<template #button>
|
||||||
<van-button
|
<van-button size="small" type="primary">
|
||||||
size="small"
|
|
||||||
type="primary"
|
|
||||||
>
|
|
||||||
{{ $t('sendSMS') }}
|
{{ $t('sendSMS') }}
|
||||||
</van-button>
|
</van-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -18,8 +18,9 @@ export default createComponent({
|
|||||||
leftIcon: String,
|
leftIcon: String,
|
||||||
rightIcon: String,
|
rightIcon: String,
|
||||||
clearable: Boolean,
|
clearable: Boolean,
|
||||||
labelClass: null,
|
maxlength: [Number, String],
|
||||||
labelWidth: [Number, String],
|
labelWidth: [Number, String],
|
||||||
|
labelClass: null,
|
||||||
labelAlign: String,
|
labelAlign: String,
|
||||||
inputAlign: String,
|
inputAlign: String,
|
||||||
errorMessage: String,
|
errorMessage: String,
|
||||||
@ -101,9 +102,9 @@ export default createComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let { value } = target;
|
let { value } = target;
|
||||||
const { maxlength } = this.$attrs;
|
const { maxlength } = this;
|
||||||
|
|
||||||
if (this.type === 'number' && isDef(maxlength) && value.length > maxlength) {
|
if (isDef(maxlength) && value.length > maxlength) {
|
||||||
value = value.slice(0, maxlength);
|
value = value.slice(0, maxlength);
|
||||||
target.value = value;
|
target.value = value;
|
||||||
}
|
}
|
||||||
@ -264,10 +265,10 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
genWordLimit() {
|
genWordLimit() {
|
||||||
if (this.showWordLimit && this.$attrs.maxlength) {
|
if (this.showWordLimit && this.maxlength) {
|
||||||
return (
|
return (
|
||||||
<div class={bem('word-limit')}>
|
<div class={bem('word-limit')}>
|
||||||
{this.value.length}/{this.$attrs.maxlength}
|
{this.value.length}/{this.maxlength}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user