Xiao_123 vor 4 Monaten
Ursprung
Commit
a03745796c
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      src/components/FormUI/TextInput/index.vue

+ 2 - 2
src/components/FormUI/TextInput/index.vue

@@ -48,7 +48,7 @@ const item = props.item
 const inputType = ref(item.type === 'phoneNumber' ? 'number' : item.type)
 
 const value = ref('')
-if (props.modelValue) value.value = props.modelValue.replace(/&/g, '&')
+if (props.modelValue && typeof props.modelValue === 'string') value.value = props.modelValue.replace(/&/g, '&')
 
 const searchDebouncedTime = item?.searchDebouncedTime === 0 ? ref(0) : ref(500)
 if (inputType.value === 'number' && item.integer) searchDebouncedTime.value = 0
@@ -65,7 +65,7 @@ const valueDeal = (val) => {
 
 watch(() => props.modelValue, (newVal) => {
   const dealData = valueDeal(newVal)
-  value.value = dealData ? dealData.replace(/&/g, '&') : ''
+  value.value = dealData ? typeof dealData === 'string' ? dealData.replace(/&/g, '&') : dealData : ''
 })
 
 const modelValueUpDate = (val) => {