限制特殊符号显示

This commit is contained in:
Linzm committed 2025-08-18 11:50:22 +08:00
1 parent 076ad1188f
commit 88b0214148
1 file changed
+5 -3
+5 -3
View File
@@ -687,9 +687,11 @@ const changeShapeText = (e: any) => {
console.log('changeShapeText', e.target.value)
if (!validateInput(e.target.value)) {
showToast('输入的文字不能包含特殊符号!')
} else {
handleInput(e.target.value)
}
// 移除特殊符号,仅保留字母、数字、中文和空格
shapeText.value = e.target.value.replace(/[^a-zA-Z0-9\u4e00-\u9fa5\s]/g, '');
return;
}
handleInput(e.target.value)
}
const validateInput = (input: string) => {