Normalize license plate input value handling in LicensePlateInput.vue:
- Ensured input field values are updated consistently with `props.actualValue`. - Replaced raw `newValue` usage with normalized string values for better data integrity. - Improved checks for synchronization and validation logic (`checkLicensePlateValid`, `searchCustomerRegistrationNumbers`).
This commit is contained in:
@@ -257,12 +257,16 @@ const isDropdownItemSelected = (registrationNumber) => {
|
||||
const inputField = ref(null);
|
||||
|
||||
watch(() => props.actualValue, (newValue) => {
|
||||
if (newValue === currentFieldVal.value) {
|
||||
const normalizedValue = String(newValue ?? '');
|
||||
if (inputField.value && inputField.value.value !== normalizedValue) {
|
||||
inputField.value.value = normalizedValue;
|
||||
}
|
||||
if (normalizedValue === currentFieldVal.value) {
|
||||
return;
|
||||
}
|
||||
currentFieldVal.value = newValue;
|
||||
checkLicensePlateValid(newValue);
|
||||
searchCustomerRegistrationNumbers(newValue);
|
||||
currentFieldVal.value = normalizedValue;
|
||||
checkLicensePlateValid(normalizedValue);
|
||||
searchCustomerRegistrationNumbers(normalizedValue);
|
||||
});
|
||||
|
||||
const onChangeReg1 = () => {
|
||||
@@ -398,4 +402,4 @@ const getCurrentIconColor = () => {
|
||||
.input.has-sharp-edges {
|
||||
border-radius: 0;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user