소스 검색

格式化

Xiao_123 4 달 전
부모
커밋
a03745796c
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  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) => {