Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gitcode_dev
开源百科
提交
2bccdf58
开
开源百科
项目概览
gitcode_dev
/
开源百科
通知
256
Star
3
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
17
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
代码片段
项目成员
Pages
开
开源百科
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
17
Issue
17
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2bccdf58
编写于
2月 14, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(#61): optimize search
上级
7fec439c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
12 deletion
+7
-12
src/utils/index.ts
src/utils/index.ts
+3
-8
src/view/index/side/index.component.html
src/view/index/side/index.component.html
+1
-1
src/view/index/side/index.component.scss
src/view/index/side/index.component.scss
+2
-2
src/view/index/side/index.component.ts
src/view/index/side/index.component.ts
+1
-1
未找到文件。
src/utils/index.ts
浏览文件 @
2bccdf58
...
...
@@ -42,12 +42,6 @@ export function randomInt(max: number) {
export
function
fuzzySearch
(
navList
:
INavProps
[],
keyword
:
string
)
{
let
searchResultList
=
[{
nav
:
[]
}]
let
url
:
null
|
string
=
null
try
{
const
{
hostname
}
=
new
URL
(
keyword
)
url
=
hostname
}
catch
{}
function
f
(
arr
?:
any
[])
{
arr
=
arr
||
navList
...
...
@@ -63,6 +57,7 @@ export function fuzzySearch(navList: INavProps[], keyword: string) {
if
(
item
.
name
)
{
const
name
=
item
.
name
.
toLowerCase
()
const
desc
=
item
.
desc
.
toLowerCase
()
const
url
=
item
.
url
.
toLowerCase
()
const
search
=
keyword
.
toLowerCase
()
const
urls
=
Object
.
values
(
item
.
urls
||
{})
...
...
@@ -80,11 +75,11 @@ export function fuzzySearch(navList: INavProps[], keyword: string) {
}
catch
(
err
)
{}
}
if
(
item
.
url
?.
includes
?.(
url
))
{
if
(
url
?.
includes
?.(
keyword
.
toLowerCase
()
))
{
searchResultList
[
0
].
nav
.
push
(
item
)
}
const
find
=
urls
.
some
((
item
:
string
)
=>
item
.
includes
(
url
))
const
find
=
urls
.
some
((
item
:
string
)
=>
item
.
includes
(
keyword
))
if
(
find
)
{
searchResultList
[
0
].
nav
.
push
(
item
)
}
...
...
src/view/index/side/index.component.html
浏览文件 @
2bccdf58
...
...
@@ -27,7 +27,7 @@
</nz-sider>
<nz-layout
class=
"inner-layout"
>
<nz-content
class=
"content"
id=
"content"
>
<div
class=
"search dark-bg-deep"
>
<div
class=
"search dark-bg-deep
dark-border-color
"
>
<app-search-engine></app-search-engine>
</div>
...
...
src/view/index/side/index.component.scss
浏览文件 @
2bccdf58
...
...
@@ -19,13 +19,13 @@ $sideWidth: 200px;
left
:
201px
;
right
:
0
;
text-align
:
center
;
background-color
:
#fff
;
}
&
.fixed
{
.search
{
top
:
0
;
border-bottom
:
1px
solid
#30363d
;
background-color
:
#fff
;
border-bottom
:
1px
solid
#ccc
;
}
}
}
...
...
src/view/index/side/index.component.ts
浏览文件 @
2bccdf58
...
...
@@ -74,7 +74,7 @@ export default class HomeComponent {
if
(
!
this
.
contentEl
)
{
this
.
contentEl
=
document
.
getElementById
(
'
content
'
)
}
if
(
y
>
10
0
)
{
if
(
y
>
7
0
)
{
this
.
contentEl
.
classList
.
add
(
'
fixed
'
)
}
else
{
this
.
contentEl
.
classList
.
remove
(
'
fixed
'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录