瀏覽代碼

格式化

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) => {