Skip to content

Commit 6ae7ea1

Browse files
LightLight
authored andcommitted
refactor(search): 检索已有网址时不再区分大小写
1 parent a3a038f commit 6ae7ea1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/js/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3121,10 +3121,14 @@ function search() {
31213121
function getNavKeyword(val) {
31223122
const results = [];
31233123
if (val) {
3124+
const lowVal = val.toLowerCase();
31243125
for (const ele of curNavList) {
31253126
const { url, title, des } = ele;
3126-
if (url.includes(val) || title.includes(val) || des.includes(val)) {
3127-
//! 区分大小写
3127+
const lowUrl = url.toLowerCase();
3128+
const lowTitle = title.toLowerCase();
3129+
const lowDes = des.toLowerCase();
3130+
if (lowUrl.includes(lowVal) || lowTitle.includes(lowVal) || lowDes.includes(lowVal)) {
3131+
//! 不区分大小写
31283132
let eq = false;
31293133
for (const item of results) {
31303134
if (isEqual(item, ele)) {

0 commit comments

Comments
 (0)