diff --git "a/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytabledoctor.vue" "b/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytabledoctor.vue" index ed042277..5fd47f6b 100644 --- "a/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytabledoctor.vue" +++ "b/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytabledoctor.vue" @@ -32,7 +32,7 @@ - + @@ -118,6 +118,16 @@ const newDoctor = ref({ salary: '', }); +const handleeditPhoneInput = () => { + // 获取输入框的值并移除所有非数字字符 + const digitsOnly = editedDoctor.value.phone.replace(/\D/g, ""); + + // 在第4个和第9个位置插入空格 + const formattedValue = insertSpaces(digitsOnly, [3, 7]); + + editedDoctor.value.phone = formattedValue; +}; + const handlePhoneInput = () => { // 获取输入框的值并移除所有非数字字符 const digitsOnly = newDoctor.value.phone.replace(/\D/g, ""); diff --git "a/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytableemployee.vue" "b/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytableemployee.vue" index efda31c3..afa3da62 100644 --- "a/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytableemployee.vue" +++ "b/src/components/\347\256\241\347\220\206\345\221\230\347\225\214\351\235\242/mytableemployee.vue" @@ -32,7 +32,7 @@ - + @@ -172,6 +172,16 @@ const options = [ }, ] +const handleeditPhoneInput = () => { + // 获取输入框的值并移除所有非数字字符 + const digitsOnly = editedEmployee.value.phone.replace(/\D/g, ""); + + // 在第4个和第9个位置插入空格 + const formattedValue = insertSpaces(digitsOnly, [3, 7]); + + editedEmployee.value.phone = formattedValue; // 更新 editedEmployee.value.phone +}; + const handlePhoneInput = () => { // 获取输入框的值并移除所有非数字字符 const digitsOnly = newEmployee.value.phone.replace(/\D/g, "");