Skip to content

Commit 723c99f

Browse files
LightLight
authored andcommitted
feat: 添加支持在搜索框检索已有网址未设定 Logo 时选取标题首字作为图片内容展示
1 parent f67f805 commit 723c99f

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/css/nav.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ body.night .search-hot-text ul li:hover {
132132
font-size: 12px;
133133
line-height: 20px;
134134
text-align: center;
135-
background: #e5e5e5;
136135
margin-right: 10px;
137136
border-radius: 10px;
138137
color: #999;

src/js/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3155,9 +3155,16 @@ function search() {
31553155
$('#box').css('display', 'block');
31563156
for (let i = 0; i < res.length; i++) {
31573157
const { url, title, des, src } = res[i];
3158-
$('#box ul').append(
3159-
`<li><span><img class="img-circle" src="${src}" /></span> <a href="${url}" target="_blank" title="${des}">${title} <small>${des}</small></a></li>`
3160-
);
3158+
if (src) {
3159+
$('#box ul').append(
3160+
`<li><span><img class="img-circle" src="${src}" /></span> <a href="${url}" target="_blank" title="${des}">${title} <small>${des}</small></a></li>`
3161+
);
3162+
} else {
3163+
const tit = title.substring(0, 1);
3164+
$('#box ul').append(
3165+
`<li><span class="img-circle no-img">${tit}</span> <a href="${url}" target="_blank" title="${des}">${title} <small>${des}</small></a></li>`
3166+
);
3167+
}
31613168
}
31623169
} else {
31633170
$('#box').css('display', 'none');

0 commit comments

Comments
 (0)