支持模糊匹配,忽略大小写

This commit is contained in:
halliday 2025-10-09 16:40:20 +08:00
parent 5e8ea8558a
commit f5e5f5c3b8
1 changed files with 5 additions and 2 deletions

View File

@ -33,8 +33,11 @@ document.addEventListener('DOMContentLoaded', function() {
return;
}
// 在数据库中查找车牌(支持模糊匹配)
const carInfo = carDatabase.find(car => car.plate.includes(plate));
// 在数据库中查找车牌(支持模糊匹配,忽略大小写)
//const carInfo = carDatabase.find(car => car.plate.includes(plate));
const carInfo = carDatabase.find(car =>
car.plate.toLowerCase().includes(plate.toLowerCase())
);
if (carInfo) {
// 将车辆信息存储到 sessionStorage