Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
unidocs-zh
提交
6e9646e2
unidocs-zh
项目概览
DCloud
/
unidocs-zh
通知
3200
Star
106
Fork
813
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
94
列表
看板
标记
里程碑
合并请求
70
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
94
Issue
94
列表
看板
标记
里程碑
合并请求
70
合并请求
70
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6e9646e2
编写于
7月 08, 2022
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Improve toc display
上级
11c18837
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
136 addition
and
77 deletion
+136
-77
docs/.vuepress/config.js
docs/.vuepress/config.js
+2
-1
docs/.vuepress/theme/components/Toc-top.vue
docs/.vuepress/theme/components/Toc-top.vue
+45
-0
docs/.vuepress/theme/components/Toc.vue
docs/.vuepress/theme/components/Toc.vue
+6
-6
docs/.vuepress/theme/layouts/Layout.vue
docs/.vuepress/theme/layouts/Layout.vue
+4
-1
docs/.vuepress/theme/styles/index.styl
docs/.vuepress/theme/styles/index.styl
+78
-68
docs/.vuepress/theme/styles/palette.styl
docs/.vuepress/theme/styles/palette.styl
+1
-1
未找到文件。
docs/.vuepress/config.js
浏览文件 @
6e9646e2
...
...
@@ -24,7 +24,7 @@ const config = {
logo
:
'
https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/5a7f902b-21a7-4822-884f-925219eacc4b.png
'
,
// TODO use plugin/theme
sidebar
:
createSidebar
(
tabs
),
// sidebarDepth: 2
,
sidebarDepth
:
0
,
nextLinks
:
false
,
prevLinks
:
false
,
// TODO use theme
...
...
@@ -44,6 +44,7 @@ const config = {
}
},
markdown
:
{
// toc: { includeLevel: [1, 2, 3, 4] },
slugify
(
str
)
{
if
(
typeof
str
!==
'
string
'
)
return
''
...
...
docs/.vuepress/theme/components/Toc-top.vue
0 → 100644
浏览文件 @
6e9646e2
<
template
>
<div
class=
"table-of-contents"
>
<div
v-for=
"item in $page.headers"
ref=
"chairTocItem"
:key=
"item.slug"
class=
"vuepress-toc-item-top"
:class=
"[`vuepress-toc-h$
{item.level}`]"
>
<a
:href=
"`#$
{item.slug}`" :title="item.title">
{{
item
.
title
}}
</a>
</div>
</div>
</
template
>
<
style
lang=
"stylus"
>
.table-of-contents
margin 0 auto
padding 2rem 2.5rem 0 2.5rem
@media (max-width: $MQNarrow)
padding 2rem 2rem 0 2rem
@media (max-width: $MQMobileNarrow)
padding 1.5rem 1.5rem 0 1.5rem
border-left: 2px solid #e6e6e6
.vuepress-toc-item-top
position relative
padding 0.1rem 0.6rem 0.1rem 1.5rem
line-height 1.5rem
border-left 2px solid rgba(0, 0, 0, 0.08)
overflow hidden
a
display block
// color $textColor
width 100%
box-sizing border-box
font-size 16px
font-weight 400
text-decoration none
transition color 0.3s
overflow hidden
text-overflow ellipsis
white-space nowrap
for i in range(2, 6)
.vuepress-toc-h{i} a
padding-left 1rem * (i - 1)
</
style
>
docs/.vuepress/theme/components/Toc.vue
浏览文件 @
6e9646e2
<
template
>
<Sticker
ref=
"sticker"
:class=
"['vuepress-toc', visible ? '' : 'table-of-contents']"
:class=
"['vuepress-toc', visible ? '' : 'table-of-contents
-sticker
']"
v-bind=
"$attrs"
>
<h5>
ON THIS PAGE
</h5>
<h5>
文档结构
</h5>
<div
v-for=
"(item, index) in $page.headers"
ref=
"chairTocItem"
:key=
"i
ndex
"
:key=
"i
tem.slug
"
class=
"vuepress-toc-item"
:class=
"[`vuepress-toc-h$
{item.level}`, { active: activeIndex === index }]"
>
...
...
@@ -114,7 +114,7 @@
</
script
>
<
style
lang=
"stylus"
>
.table-of-contents
.table-of-contents
-sticker
display none !important
.vuepress-toc
position fixed
...
...
@@ -157,7 +157,7 @@
.vuepress-toc-h1 a
.vuepress-toc-h2 a
font-weight bold
for i in range(
3
, 6)
for i in range(
2
, 6)
.vuepress-toc-h{i} a
padding-left 1rem * (i -
2
)
padding-left 1rem * (i -
1
)
</
style
>
docs/.vuepress/theme/layouts/Layout.vue
浏览文件 @
6e9646e2
...
...
@@ -38,6 +38,7 @@
>
<
template
#top
>
<slot
name=
"page-top"
/>
<TocTop/>
</
template
>
<
template
#bottom
>
<slot
name=
"page-bottom"
/>
...
...
@@ -57,6 +58,7 @@ import Sidebar from '@theme/components/Sidebar.vue'
import
Footer
from
'
@theme/components/Footer.vue
'
;
import
SiderBarBottom
from
'
../components/SiderBarBottom.vue
'
;
import
Toc
from
'
../components/Toc
'
;
import
TocTop
from
'
../components/Toc-top
'
;
import
{
resolveSidebarItems
,
forbidScroll
,
BaiduStat
}
from
'
../util
'
import
navProvider
from
'
../mixin/navProvider
'
;
import
toc
from
'
../mixin/toc
'
;
...
...
@@ -71,7 +73,8 @@ export default {
Navbar
,
Footer
,
SiderBarBottom
,
Toc
Toc
,
TocTop
},
data
()
{
return
{
...
...
docs/.vuepress/theme/styles/index.styl
浏览文件 @
6e9646e2
.custom-page-class{
position: relative;
.custom-page-class
position relative
/* 首页几个logo的排版 */
.flex-img-group-view
{
.flex-img-group-view
display flex
flex-direction row
margin 10px 0
.barcode-view {
.barcode-view
display flex
align-items center
flex-direction column
margin 0 5px
margin-bottom 20px
b {
b
text-align center
}
}
}
.uniapp-home-content
{
.uniapp-home-content
display flex
flex-wrap wrap
width 100%
justify-content center
.uniapp-home-content-item {
.uniapp-home-content-item
margin-bottom 20px
.uniapp-home-content-item-image {
.uniapp-home-content-item-image
width 55px
height 55px
flex-shrink 0
img {
img
height 100%
}
}
p.uniapp-home-content-item-text {
p.uniapp-home-content-item-text
margin-bottom 0px
letter-spacing 0px
color #333
}
.uniapp-home-content-item-title
{
.uniapp-home-content-item-title
font-size 16px
}
}
}
@media screen and (min-width: 768px) {
.flex-img-group-view {
@media screen and (min-width 768px)
.flex-img-group-view
justify-content space-around
}
.uniapp-home-content-item
{
.uniapp-home-content-item
width 32%
}
}
@media screen and (max-width: 600px) {
.uniapp-home-content-item{
@media screen and (max-width 600px)
.uniapp-home-content-item
width 100%
display flex
flex-direction row
}
.uniapp-home-content-item-header
{
.uniapp-home-content-item-header
display flex
flex-direction column
padding-left 15px
}
.uniapp-home-content-item-title
{
.uniapp-home-content-item-title
line-height 10px
}
}
}
img {
image-rendering: -moz-crisp-edges; /* Firefox*/
image-rendering: -o-crisp-edges; /* Opera */
image-rendering: -webkit-optimize-contrast; /*Webkit (non-standard naming) */
image-rendering: crisp-edges;
-ms-interpolation-mode: nearest-neighbor; /* I (non-standard property) */
}
img
image-rendering -moz-crisp-edges /* Firefox */
image-rendering -o-crisp-edges /* Opera */
image-rendering -webkit-optimize-contrast /* Webkit (non-standard naming) */
image-rendering crisp-edges
-ms-interpolation-mode nearest-neighbor /* I (non-standard property) */
body.forbid_scroll
height 100%
...
...
@@ -83,22 +78,36 @@ main.page
padding-bottom 0px
padding-right 0px
@media (min-width:
$vuepress-display-min-width)
&
@media (min-width
$vuepress-display-min-width)
main.page
padding-right $vuepress-toc-width
@media (min-width: $vuepress-display-min-width)
.vuepress-toc
display block !important
.table-of-contents
display none !important
@media (max-width $vuepress-display-min-width)
.table-of-contents
display block !important
@media (min-width 2000px)
$vuepress-toc-width = 20rem
.vuepress-toc
width: $vuepress-toc-width !important
main.page
padding-right $vuepress-toc-width
{$contentClass}:not(.custom)
> *:first-child
margin-top 0
@media (max-width: $MQMobile)
@media (max-width $MQMobile)
&
margin-top $navbarHeight
img
max-width 100% !important
table
position relative
...
...
@@ -106,18 +115,19 @@ main.page
word-break break-all
h1, h2, h3, h4, h5, h6
{$contentClass}:not(.custom) > &
margin-top
(5rem - $navbarHeight)
padding-top ($navbarHeight - 3rem)
margin-top
5rem - $navbarHeight
padding-top
:
($navbarHeight - 3rem)
&:first-child
margin-top (3rem - $navbarHeight)
padding-top ($navbarHeight - 3rem)
@media (max-width: $MQMobile)
margin-top 3rem - $navbarHeight
padding-top: ($navbarHeight - 3rem)
@media (max-width $MQMobile)
&
margin-top 3rem
@media (min-width: $MQMobile)
@media (min-width $MQMobile)
.nav-dropdown
z-index 1
...
...
docs/.vuepress/theme/styles/palette.styl
浏览文件 @
6e9646e2
...
...
@@ -5,5 +5,5 @@ $navbarHeight = 9rem
$navbar-sub-navbar-height = 5rem
$navbar-background-color = #f7f7f7
$search-container-color = #f5f6f7
$vuepress-toc-width =
220px
$vuepress-toc-width =
14rem
$vuepress-display-min-width = 1500px
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录