Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
unidocs-zh
提交
833166d5
unidocs-zh
项目概览
DCloud
/
unidocs-zh
通知
3614
Star
108
Fork
927
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
118
列表
看板
标记
里程碑
合并请求
110
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
118
Issue
118
列表
看板
标记
里程碑
合并请求
110
合并请求
110
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
833166d5
编写于
3月 23, 2022
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: search folder structure
上级
d73e8a27
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
69 addition
and
62 deletion
+69
-62
docs/.vuepress/theme/components/DcloudSearchPage/components/Result.vue
...s/theme/components/DcloudSearchPage/components/Result.vue
+42
-43
docs/.vuepress/theme/components/DcloudSearchPage/components/Results.vue
.../theme/components/DcloudSearchPage/components/Results.vue
+10
-1
docs/.vuepress/theme/components/DcloudSearchPage/index.vue
docs/.vuepress/theme/components/DcloudSearchPage/index.vue
+12
-11
docs/.vuepress/theme/components/DcloudSearchPage/utils/mock.js
....vuepress/theme/components/DcloudSearchPage/utils/mock.js
+0
-0
docs/.vuepress/theme/components/DcloudSearchPage/utils/postDcloudServer.js
...eme/components/DcloudSearchPage/utils/postDcloudServer.js
+0
-0
docs/.vuepress/theme/components/DcloudSearchPage/utils/searchClient.js
...s/theme/components/DcloudSearchPage/utils/searchClient.js
+5
-5
docs/.vuepress/theme/components/DcloudSearchPage/utils/searchUtils.js
...ss/theme/components/DcloudSearchPage/utils/searchUtils.js
+0
-0
docs/.vuepress/theme/util/index.js
docs/.vuepress/theme/util/index.js
+0
-2
未找到文件。
docs/.vuepress/theme/components/DcloudSearchPage/components/Result.vue
浏览文件 @
833166d5
<
template
>
<li
:class=
"li_class"
>
<a
:href=
"item.url"
@
click=
"onSearchClose"
>
<a
:href=
"item.url"
>
<div
class=
"DocSearch-Hit-Container"
>
<div
class=
"DocSearch-Hit-content-wrapper"
...
...
@@ -44,7 +44,6 @@
data
()
{
return
{};
},
inject
:
[
'
onSearchClose
'
],
props
:
{
item
:
{
type
:
Object
,
...
...
@@ -76,51 +75,51 @@
};
</
script
>
<
style
lang=
"stylus"
>
.DocSearch-Hit
border-radius 0px
display flex
padding-bottom 0px
position relative
.DocSearch-Hit
border-radius 0px
display flex
padding-bottom 0px
position relative
&:not(:first-child)
border-top 1px solid #f5f6f7
&:not(:first-child)
border-top 1px solid #f5f6f7
a
background var(--docsearch-hit-background)
border-radius 0px
// box-shadow var(--docsearch-hit-shadow)
box-shadow none
display block
padding-left var(--docsearch-spacing)
width 100%
a
background var(--docsearch-hit-background)
border-radius 0px
// box-shadow var(--docsearch-hit-shadow)
box-shadow none
display block
padding-left var(--docsearch-spacing)
width 100%
.DocSearch-Hit-Container
align-items center
color #444950
display flex
flex-direction row
height 56px
padding 0 12px 0 0
.DocSearch-Hit-Container
align-items center
color #444950
display flex
flex-direction row
height 56px
padding 0 12px 0 0
.DocSearch-Hit-content-wrapper
overflow hidden
display flex
flex 1 1 auto
flex-direction column
font-weight 500
justify-content center
line-height 1.2em
margin 0 8px
overflow-x hidden
position relative
text-overflow ellipsis
white-space nowrap
width 80%
.DocSearch-Hit-content-wrapper
overflow hidden
display flex
flex 1 1 auto
flex-direction column
font-weight 500
justify-content center
line-height 1.2em
margin 0 8px
overflow-x hidden
position relative
text-overflow ellipsis
white-space nowrap
width 80%
.DocSearch-Hit-title
font-size 0.9em
.DocSearch-Hit-title
font-size 0.9em
.DocSearch-Hit-path
// color $accentColor
font-size 0.75em
.DocSearch-Hit-path
// color $accentColor
font-size 0.75em
</
style
>
docs/.vuepress/theme/components/DcloudSearchPage/components/Results.vue
浏览文件 @
833166d5
...
...
@@ -9,7 +9,12 @@
<ul
id=
"docsearch-list"
>
<template
v-for=
"(item, index) in results"
>
<Result
:key=
"[title, item.objectID].join(':')"
:item=
"item"
:index=
"index"
/>
<Result
:key=
"[title, item.objectID].join(':')"
:item=
"item"
:index=
"index"
@
click.native=
"event => onSelect(
{ item, event })"
/>
</
template
>
</ul>
</section>
...
...
@@ -30,6 +35,10 @@
type
:
Array
,
default
:
[],
},
onSelect
:
{
type
:
Function
,
default
:
()
=>
{},
},
},
computed
:
{
tag
()
{
...
...
docs/.vuepress/theme/components/DcloudSearchPage/index.vue
浏览文件 @
833166d5
...
...
@@ -85,7 +85,12 @@
<div
class=
"result-wrap"
>
<
template
v-if=
"isAlgolia"
>
<template
v-for=
"item in resultList"
>
<Results
:key=
"item.id"
:title=
"item.title"
:results=
"item.items"
/>
<Results
:key=
"item.sourceId"
:title=
"item.title"
:results=
"item.items"
:onSelect=
"item.onSelect"
/>
</
template
>
</template>
...
...
@@ -139,9 +144,10 @@
import
Results
from
'
./components/Results.vue
'
;
import
pagination
from
'
./components/pagination.vue
'
;
import
MainNavbarLink
from
'
../MainNavbarLink.vue
'
;
import
{
search
as
searchClient
}
from
'
./searchClient
'
;
import
{
postExt
,
postAsk
}
from
'
./postDcloudServer
'
;
import
{
forbidScroll
,
removeHighlightTags
,
debounce
,
isEditingContent
}
from
'
../../util
'
;
import
{
search
as
searchClient
}
from
'
./utils/searchClient
'
;
import
{
postExt
,
postAsk
}
from
'
./utils/postDcloudServer
'
;
import
{
forbidScroll
,
debounce
}
from
'
../../util
'
;
import
{
removeHighlightTags
,
isEditingContent
}
from
'
./utils/searchUtils
'
;
const
resolveRoutePathFromUrl
=
(
url
,
base
=
'
/
'
)
=>
url
...
...
@@ -157,12 +163,6 @@
components
:
{
NavbarLogo
,
Results
,
pagination
,
MainNavbarLink
},
provide
()
{
return
{
onSearchClose
:
this
.
onSearchClose
,
};
},
data
()
{
return
{
openSearch
:
false
,
...
...
@@ -314,7 +314,7 @@
this
.
resultList
=
hits
.
map
(
item
=>
{
const
items
=
item
.
getItems
();
return
{
id
:
item
.
sourceId
,
...
item
,
title
:
removeHighlightTags
(
items
[
0
]),
items
,
};
...
...
@@ -356,6 +356,7 @@
url
:
resolveRoutePathFromUrl
(
item
.
url
,
this
.
$site
.
base
),
};
}),
onClose
:
this
.
onSearchClose
,
})
);
},
...
...
docs/.vuepress/theme/components/DcloudSearchPage/mock.js
→
docs/.vuepress/theme/components/DcloudSearchPage/
utils/
mock.js
浏览文件 @
833166d5
文件已移动
docs/.vuepress/theme/components/DcloudSearchPage/postDcloudServer.js
→
docs/.vuepress/theme/components/DcloudSearchPage/
utils/
postDcloudServer.js
浏览文件 @
833166d5
文件已移动
docs/.vuepress/theme/components/DcloudSearchPage/searchClient.js
→
docs/.vuepress/theme/components/DcloudSearchPage/
utils/
searchClient.js
浏览文件 @
833166d5
import
algoliasearch
from
'
algoliasearch/dist/algoliasearch-lite.esm.browser
'
;
import
{
removeHighlightTags
,
groupBy
}
from
'
.
./../util
'
import
{
removeHighlightTags
,
groupBy
}
from
'
.
/searchUtils
'
let
searchClient
function
createSearchClient
(
appId
,
apiKey
)
{
...
...
@@ -10,7 +10,7 @@ function createSearchClient(appId, apiKey) {
return
searchClient
}
export
function
search
({
query
,
indexName
,
appId
,
apiKey
,
searchParameters
=
{},
snippetLength
=
0
,
transformItems
=
()
=>
{
},
...
args
})
{
export
function
search
({
query
,
indexName
,
appId
,
apiKey
,
searchParameters
=
{},
snippetLength
=
0
,
transformItems
=
()
=>
{
},
onClose
=
()
=>
{
},
...
args
})
{
return
createSearchClient
(
appId
,
apiKey
)
.
search
([
{
...
...
@@ -65,9 +65,9 @@ export function search({ query, indexName, appId, apiKey, searchParameters = {},
onSelect
({
item
,
event
})
{
// saveRecentSearch(item);
//
if (!event.shiftKey && !event.ctrlKey && !event.metaKey) {
// onClose();
//
}
if
(
!
event
.
shiftKey
&&
!
event
.
ctrlKey
&&
!
event
.
metaKey
)
{
onClose
()
}
},
getItemUrl
({
item
})
{
return
item
.
url
;
...
...
docs/.vuepress/theme/
util
/searchUtils.js
→
docs/.vuepress/theme/
components/DcloudSearchPage/utils
/searchUtils.js
浏览文件 @
833166d5
文件已移动
docs/.vuepress/theme/util/index.js
浏览文件 @
833166d5
import
Vue
from
'
vue
'
;
export
*
from
'
./searchUtils
'
;
export
const
isServer
=
Vue
.
prototype
.
$isServer
export
const
hashRE
=
/#.*$/
export
const
extRE
=
/
\.(
md|html
)
$/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录