Compare commits

...

2 Commits

Author SHA1 Message Date
jinsir b7d7a3963a Merge branch 'main' of http://113.45.67.59:3003/lzq/test 2025-11-17 19:57:31 +08:00
jinsir a4e4e2a1ce 更新 2025-11-17 19:57:08 +08:00
1 changed files with 4 additions and 14 deletions

View File

@ -24,26 +24,16 @@ export function WeatherSearchForm() {
setInputError('请输入城市名称');
return;
}
if (trimmedCity.length < 2) {
if (trimmedCity.length <2) {
setInputError('请输入至少2个字符');
return;
}
if (!/^[a-zA-Z\s]+$/.test(trimmedCity)) {
setInputError('请输入字母和空格');
if (!/^[\u4e00-\u9fa5a-zA-Z\s-]+$/.test(trimmedCity)) {
setInputError('请输入有效的城市名称');
return;
}
await searchWeather(trimmedCity);
if (trimmedCity.length < 2) {
setInputError('请输入至少2个字符');
return;
}
if (!/^[a-zA-Z\s]+$/.test(trimmedCity)) {
setInputError('请输入字母和空格');
return;
}
await searchWeather(trimmedCity);
}
return (