1、element-UI中
<el-input :value="form.trailerNo" @input="(e) => { form.trailerNo = e.toUpperCase().replace(/^\s+|\s+$/g, '') }" clearable placeholder="请输入" />
2、Vant中
<van-field
v-model="info.carNo"
clearable
placeholder="请输入车牌号"
:formatter="formatterCarNumber"
:rules="[
{
required: true,
pattern: carNoReg,
message: '请正确输入车牌号',
},
]"
/>
<script>
methods: {
// 车牌号转大写
formatterCarNumber(value) {
value = value.toUpperCase()
return value
},
}
</script>