Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计算机应用开发
前端
Vuepress
提交
b4853c3e
V
Vuepress
项目概览
计算机应用开发
/
前端
/
Vuepress
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
Vuepress
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b4853c3e
编写于
12月 03, 2019
作者:
M
meteorlxy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
style: lint code
上级
ba1f7c79
变更
38
展开全部
隐藏空白更改
内联
并排
Showing
38 changed file
with
599 addition
and
230 deletion
+599
-230
packages/@vuepress/core/lib/client/app.js
packages/@vuepress/core/lib/client/app.js
+3
-1
packages/@vuepress/core/lib/client/components/GlobalLayout.vue
...ges/@vuepress/core/lib/client/components/GlobalLayout.vue
+11
-9
packages/@vuepress/core/lib/client/components/NotFound.vue
packages/@vuepress/core/lib/client/components/NotFound.vue
+5
-1
packages/@vuepress/core/lib/client/components/OutboundLink.vue
...ges/@vuepress/core/lib/client/components/OutboundLink.vue
+18
-3
packages/@vuepress/core/lib/node/docs.fallback/.vuepress/theme/Layout.vue
...ss/core/lib/node/docs.fallback/.vuepress/theme/Layout.vue
+1
-1
packages/@vuepress/core/lib/node/theme-api/Layout.fallback.vue
...ges/@vuepress/core/lib/node/theme-api/Layout.fallback.vue
+1
-1
packages/@vuepress/markdown/lib/link.js
packages/@vuepress/markdown/lib/link.js
+2
-2
packages/@vuepress/plugin-back-to-top/BackToTop.vue
packages/@vuepress/plugin-back-to-top/BackToTop.vue
+24
-9
packages/@vuepress/plugin-back-to-top/enhanceAppFile.js
packages/@vuepress/plugin-back-to-top/enhanceAppFile.js
+1
-0
packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue
packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue
+16
-9
packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js
packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js
+1
-0
packages/@vuepress/plugin-search/SearchBox.vue
packages/@vuepress/plugin-search/SearchBox.vue
+24
-15
packages/@vuepress/theme-default/__tests__/components/DropdownLink.spec.js
...s/theme-default/__tests__/components/DropdownLink.spec.js
+1
-1
packages/@vuepress/theme-default/__tests__/components/NavLink.spec.js
...epress/theme-default/__tests__/components/NavLink.spec.js
+1
-1
packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue
...s/@vuepress/theme-default/components/AlgoliaSearchBox.vue
+12
-10
packages/@vuepress/theme-default/components/DropdownLink.vue
packages/@vuepress/theme-default/components/DropdownLink.vue
+31
-24
packages/@vuepress/theme-default/components/DropdownTransition.vue
...@vuepress/theme-default/components/DropdownTransition.vue
+1
-1
packages/@vuepress/theme-default/components/Home.vue
packages/@vuepress/theme-default/components/Home.vue
+21
-8
packages/@vuepress/theme-default/components/NavLink.vue
packages/@vuepress/theme-default/components/NavLink.vue
+10
-6
packages/@vuepress/theme-default/components/NavLinks.vue
packages/@vuepress/theme-default/components/NavLinks.vue
+9
-4
packages/@vuepress/theme-default/components/Navbar.vue
packages/@vuepress/theme-default/components/Navbar.vue
+25
-18
packages/@vuepress/theme-default/components/PageEdit.vue
packages/@vuepress/theme-default/components/PageEdit.vue
+16
-3
packages/@vuepress/theme-default/components/PageNav.vue
packages/@vuepress/theme-default/components/PageNav.vue
+51
-8
packages/@vuepress/theme-default/components/Sidebar.vue
packages/@vuepress/theme-default/components/Sidebar.vue
+9
-4
packages/@vuepress/theme-default/components/SidebarButton.vue
...ages/@vuepress/theme-default/components/SidebarButton.vue
+16
-3
packages/@vuepress/theme-default/components/SidebarGroup.vue
packages/@vuepress/theme-default/components/SidebarGroup.vue
+23
-12
packages/@vuepress/theme-default/components/SidebarLink.vue
packages/@vuepress/theme-default/components/SidebarLink.vue
+1
-1
packages/@vuepress/theme-default/components/SidebarLinks.vue
packages/@vuepress/theme-default/components/SidebarLinks.vue
+10
-7
packages/@vuepress/theme-default/layouts/404.vue
packages/@vuepress/theme-default/layouts/404.vue
+5
-1
packages/@vuepress/theme-default/layouts/Layout.vue
packages/@vuepress/theme-default/layouts/Layout.vue
+13
-6
packages/@vuepress/theme-vue/components/BuySellAds.vue
packages/@vuepress/theme-vue/components/BuySellAds.vue
+17
-12
packages/@vuepress/theme-vue/components/CarbonAds.vue
packages/@vuepress/theme-vue/components/CarbonAds.vue
+11
-6
packages/@vuepress/theme-vue/layouts/Layout.vue
packages/@vuepress/theme-vue/layouts/Layout.vue
+4
-2
packages/docs/docs/.vuepress/components/Bit.vue
packages/docs/docs/.vuepress/components/Bit.vue
+8
-2
packages/docs/docs/.vuepress/components/OtherComponent.vue
packages/docs/docs/.vuepress/components/OtherComponent.vue
+3
-1
packages/docs/docs/.vuepress/components/diagram-markdown-slot-relationship.vue
...uepress/components/diagram-markdown-slot-relationship.vue
+188
-31
packages/docs/docs/.vuepress/components/svg-container.vue
packages/docs/docs/.vuepress/components/svg-container.vue
+6
-6
scripts/test.js
scripts/test.js
+0
-1
未找到文件。
packages/@vuepress/core/lib/client/app.js
浏览文件 @
b4853c3e
...
@@ -38,6 +38,7 @@ Vue.use(VuePress)
...
@@ -38,6 +38,7 @@ Vue.use(VuePress)
Vue
.
mixin
(
dataMixin
(
ClientComputedMixin
,
siteData
))
Vue
.
mixin
(
dataMixin
(
ClientComputedMixin
,
siteData
))
// component for rendering markdown content and setting title etc.
// component for rendering markdown content and setting title etc.
/* eslint-disable vue/match-component-file-name */
Vue
.
component
(
'
Content
'
,
Content
)
Vue
.
component
(
'
Content
'
,
Content
)
Vue
.
component
(
'
ContentSlotsDistributor
'
,
ContentSlotsDistributor
)
Vue
.
component
(
'
ContentSlotsDistributor
'
,
ContentSlotsDistributor
)
Vue
.
component
(
'
OutboundLink
'
,
OutboundLink
)
Vue
.
component
(
'
OutboundLink
'
,
OutboundLink
)
...
@@ -46,6 +47,7 @@ Vue.component('ClientOnly', ClientOnly)
...
@@ -46,6 +47,7 @@ Vue.component('ClientOnly', ClientOnly)
// core components
// core components
Vue
.
component
(
'
Layout
'
,
getLayoutAsyncComponent
(
'
Layout
'
))
Vue
.
component
(
'
Layout
'
,
getLayoutAsyncComponent
(
'
Layout
'
))
Vue
.
component
(
'
NotFound
'
,
getLayoutAsyncComponent
(
'
NotFound
'
))
Vue
.
component
(
'
NotFound
'
,
getLayoutAsyncComponent
(
'
NotFound
'
))
/* eslint-disable-next-line vue/match-component-file-name */
// global helper for adding base path to absolute urls
// global helper for adding base path to absolute urls
Vue
.
prototype
.
$withBase
=
function
(
path
)
{
Vue
.
prototype
.
$withBase
=
function
(
path
)
{
...
@@ -102,7 +104,7 @@ export function createApp (isServer) {
...
@@ -102,7 +104,7 @@ export function createApp (isServer) {
router
,
router
,
render
(
h
)
{
render
(
h
)
{
return
h
(
'
div
'
,
{
attrs
:
{
id
:
'
app
'
}},
[
return
h
(
'
div
'
,
{
attrs
:
{
id
:
'
app
'
}},
[
h
(
'
router-v
iew
'
,
{
ref
:
'
layout
'
}),
h
(
'
RouterV
iew
'
,
{
ref
:
'
layout
'
}),
h
(
'
div
'
,
{
class
:
'
global-ui
'
},
globalUIComponents
.
map
(
component
=>
h
(
component
)))
h
(
'
div
'
,
{
class
:
'
global-ui
'
},
globalUIComponents
.
map
(
component
=>
h
(
component
)))
])
])
}
}
...
...
packages/@vuepress/core/lib/client/components/GlobalLayout.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<component
:is=
"layout"
/>
<component
:is=
"layout"
/>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -7,6 +7,16 @@ import Vue from 'vue'
...
@@ -7,6 +7,16 @@ import Vue from 'vue'
import
{
setGlobalInfo
}
from
'
@app/util
'
import
{
setGlobalInfo
}
from
'
@app/util
'
export
default
{
export
default
{
name
:
'
GlobalLayout
'
,
computed
:
{
layout
()
{
const
layout
=
this
.
getLayout
()
setGlobalInfo
(
'
layout
'
,
layout
)
return
Vue
.
component
(
layout
)
}
},
methods
:
{
methods
:
{
getLayout
()
{
getLayout
()
{
if
(
this
.
$page
.
path
)
{
if
(
this
.
$page
.
path
)
{
...
@@ -19,14 +29,6 @@ export default {
...
@@ -19,14 +29,6 @@ export default {
}
}
return
'
NotFound
'
return
'
NotFound
'
}
}
},
computed
:
{
layout
()
{
const
layout
=
this
.
getLayout
()
setGlobalInfo
(
'
layout
'
,
layout
)
return
Vue
.
component
(
layout
)
}
}
}
}
}
</
script
>
</
script
>
packages/@vuepress/core/lib/client/components/NotFound.vue
浏览文件 @
b4853c3e
...
@@ -2,8 +2,12 @@
...
@@ -2,8 +2,12 @@
<div
class=
"theme-container"
>
<div
class=
"theme-container"
>
<div
class=
"content"
>
<div
class=
"content"
>
<h1>
404
</h1>
<h1>
404
</h1>
<blockquote>
{{
getMsg
()
}}
</blockquote>
<blockquote>
{{
getMsg
()
}}
</blockquote>
<router-link
to=
"/"
>
Take me home.
</router-link>
<RouterLink
to=
"/"
>
Take me home.
</RouterLink>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
...
packages/@vuepress/core/lib/client/components/OutboundLink.vue
浏览文件 @
b4853c3e
<
template
functional
>
<
template
functional
>
<svg
class=
"icon outbound"
xmlns=
"http://www.w3.org/2000/svg"
aria-hidden=
"true"
x=
"0px"
y=
"0px"
viewBox=
"0 0 100 100"
width=
"15"
height=
"15"
>
<svg
<path
fill=
"currentColor"
d=
"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"
></path>
class=
"icon outbound"
<polygon
fill=
"currentColor"
points=
"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"
></polygon>
xmlns=
"http://www.w3.org/2000/svg"
aria-hidden=
"true"
x=
"0px"
y=
"0px"
viewBox=
"0 0 100 100"
width=
"15"
height=
"15"
>
<path
fill=
"currentColor"
d=
"M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"
/>
<polygon
fill=
"currentColor"
points=
"45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"
/>
</svg>
</svg>
</
template
>
</
template
>
...
...
packages/@vuepress/core/lib/node/docs.fallback/.vuepress/theme/Layout.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<Content/>
<Content
/>
</
template
>
</
template
>
packages/@vuepress/core/lib/node/theme-api/Layout.fallback.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<Content/>
<Content
/>
</
template
>
</
template
>
packages/@vuepress/markdown/lib/link.js
浏览文件 @
b4853c3e
...
@@ -67,14 +67,14 @@ module.exports = (md, externalAttrs) => {
...
@@ -67,14 +67,14 @@ module.exports = (md, externalAttrs) => {
routerLinks
.
push
(
to
)
routerLinks
.
push
(
to
)
return
Object
.
create
(
token
,
{
return
Object
.
create
(
token
,
{
tag
:
{
value
:
'
router-l
ink
'
}
tag
:
{
value
:
'
RouterL
ink
'
}
})
})
}
}
md
.
renderer
.
rules
.
link_close
=
(
tokens
,
idx
,
options
,
env
,
self
)
=>
{
md
.
renderer
.
rules
.
link_close
=
(
tokens
,
idx
,
options
,
env
,
self
)
=>
{
const
token
=
tokens
[
idx
]
const
token
=
tokens
[
idx
]
if
(
hasOpenRouterLink
)
{
if
(
hasOpenRouterLink
)
{
token
.
tag
=
'
router-l
ink
'
token
.
tag
=
'
RouterL
ink
'
hasOpenRouterLink
=
false
hasOpenRouterLink
=
false
}
}
if
(
hasOpenExternalLink
)
{
if
(
hasOpenExternalLink
)
{
...
...
packages/@vuepress/plugin-back-to-top/BackToTop.vue
浏览文件 @
b4853c3e
...
@@ -3,12 +3,25 @@
...
@@ -3,12 +3,25 @@
<svg
<svg
v-if=
"show"
v-if=
"show"
class=
"go-to-top"
class=
"go-to-top"
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 49.484 28.284"
@
click=
"scrollToTop"
@
click=
"scrollToTop"
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 49.484 28.284"
>
>
<g
transform=
"translate(-229 -126.358)"
>
<g
transform=
"translate(-229 -126.358)"
>
<rect
fill=
"currentColor"
width=
"35"
height=
"5"
rx=
"2"
transform=
"translate(229 151.107) rotate(-45)"
/>
<rect
<rect
fill=
"currentColor"
width=
"35"
height=
"5"
rx=
"2"
transform=
"translate(274.949 154.642) rotate(-135)"
/>
fill=
"currentColor"
width=
"35"
height=
"5"
rx=
"2"
transform=
"translate(229 151.107) rotate(-45)"
/>
<rect
fill=
"currentColor"
width=
"35"
height=
"5"
rx=
"2"
transform=
"translate(274.949 154.642) rotate(-135)"
/>
</g>
</g>
</svg>
</svg>
</transition>
</transition>
...
@@ -18,6 +31,8 @@
...
@@ -18,6 +31,8 @@
import
debounce
from
'
lodash.debounce
'
import
debounce
from
'
lodash.debounce
'
export
default
{
export
default
{
name
:
'
BackToTop
'
,
props
:
{
props
:
{
threshold
:
{
threshold
:
{
type
:
Number
,
type
:
Number
,
...
@@ -31,6 +46,12 @@ export default {
...
@@ -31,6 +46,12 @@ export default {
}
}
},
},
computed
:
{
show
()
{
return
this
.
scrollTop
>
this
.
threshold
}
},
mounted
()
{
mounted
()
{
this
.
scrollTop
=
this
.
getScrollTop
()
this
.
scrollTop
=
this
.
getScrollTop
()
window
.
addEventListener
(
'
scroll
'
,
debounce
(()
=>
{
window
.
addEventListener
(
'
scroll
'
,
debounce
(()
=>
{
...
@@ -49,12 +70,6 @@ export default {
...
@@ -49,12 +70,6 @@ export default {
window
.
scrollTo
({
top
:
0
,
behavior
:
'
smooth
'
})
window
.
scrollTo
({
top
:
0
,
behavior
:
'
smooth
'
})
this
.
scrollTop
=
0
this
.
scrollTop
=
0
}
}
},
computed
:
{
show
()
{
return
this
.
scrollTop
>
this
.
threshold
}
}
}
}
}
</
script
>
</
script
>
...
...
packages/@vuepress/plugin-back-to-top/enhanceAppFile.js
浏览文件 @
b4853c3e
import
BackToTop
from
'
./BackToTop.vue
'
import
BackToTop
from
'
./BackToTop.vue
'
export
default
({
Vue
})
=>
{
export
default
({
Vue
})
=>
{
// eslint-disable-next-line vue/match-component-file-name
Vue
.
component
(
'
BackToTop
'
,
BackToTop
)
Vue
.
component
(
'
BackToTop
'
,
BackToTop
)
}
}
packages/@vuepress/plugin-pwa/lib/SWUpdatePopup.vue
浏览文件 @
b4853c3e
...
@@ -10,8 +10,13 @@
...
@@ -10,8 +10,13 @@
v-if=
"enabled"
v-if=
"enabled"
class=
"sw-update-popup"
class=
"sw-update-popup"
>
>
{{
message
}}
<br>
{{
message
}}
<button
@
click=
"reload"
>
{{
buttonText
}}
</button>
<br>
<button
@
click=
"reload"
>
{{
buttonText
}}
</button>
</div>
</div>
</slot>
</slot>
</transition>
</transition>
...
@@ -24,6 +29,8 @@ import { normalizeConfig } from '@app/util'
...
@@ -24,6 +29,8 @@ import { normalizeConfig } from '@app/util'
import
{
popupConfig
as
defaultPopupConfig
}
from
'
./i18n
'
import
{
popupConfig
as
defaultPopupConfig
}
from
'
./i18n
'
export
default
{
export
default
{
name
:
'
SWUpdatePopup
'
,
data
()
{
data
()
{
return
{
return
{
rawPopupConfig
:
SW_UPDATE_POPUP
,
rawPopupConfig
:
SW_UPDATE_POPUP
,
...
@@ -31,13 +38,6 @@ export default {
...
@@ -31,13 +38,6 @@ export default {
}
}
},
},
created
()
{
event
.
$on
(
'
sw-updated
'
,
this
.
onSWUpdated
)
if
(
SW_UPDATE_POPUP
===
true
)
{
this
.
rawPopupConfig
=
defaultPopupConfig
}
},
computed
:
{
computed
:
{
popupConfig
()
{
popupConfig
()
{
return
normalizeConfig
(
this
,
this
.
rawPopupConfig
)
return
normalizeConfig
(
this
,
this
.
rawPopupConfig
)
...
@@ -58,6 +58,13 @@ export default {
...
@@ -58,6 +58,13 @@ export default {
}
}
},
},
created
()
{
event
.
$on
(
'
sw-updated
'
,
this
.
onSWUpdated
)
if
(
SW_UPDATE_POPUP
===
true
)
{
this
.
rawPopupConfig
=
defaultPopupConfig
}
},
methods
:
{
methods
:
{
onSWUpdated
(
e
)
{
onSWUpdated
(
e
)
{
this
.
updateEvent
=
e
this
.
updateEvent
=
e
...
...
packages/@vuepress/plugin-pwa/lib/enhanceAppFile.js
浏览文件 @
b4853c3e
...
@@ -6,6 +6,7 @@ import SWUpdateEvent from './SWUpdateEvent'
...
@@ -6,6 +6,7 @@ import SWUpdateEvent from './SWUpdateEvent'
import
event
from
'
./event
'
import
event
from
'
./event
'
if
(
SW_UPDATE_POPUP
)
{
if
(
SW_UPDATE_POPUP
)
{
// eslint-disable-next-line vue/match-component-file-name
Vue
.
component
(
'
SWUpdatePopup
'
,
()
=>
import
(
'
./SWUpdatePopup.vue
'
))
Vue
.
component
(
'
SWUpdatePopup
'
,
()
=>
import
(
'
./SWUpdatePopup.vue
'
))
}
}
...
...
packages/@vuepress/plugin-search/SearchBox.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<div
class=
"search-box"
>
<div
class=
"search-box"
>
<input
<input
@
input=
"query = $event.target.value
"
ref=
"input
"
aria-label=
"Search"
aria-label=
"Search"
:value=
"query"
:value=
"query"
:class=
"
{ 'focused': focused }"
:class=
"
{ 'focused': focused }"
:placeholder="placeholder"
:placeholder="placeholder"
autocomplete="off"
autocomplete="off"
spellcheck="false"
spellcheck="false"
@input="query = $event.target.value"
@focus="focused = true"
@focus="focused = true"
@blur="focused = false"
@blur="focused = false"
@keyup.enter="go(focusIndex)"
@keyup.enter="go(focusIndex)"
@keyup.up="onUp"
@keyup.up="onUp"
@keyup.down="onDown"
@keyup.down="onDown"
ref="input"
>
>
<ul
<ul
class=
"suggestions"
v-if=
"showSuggestions"
v-if=
"showSuggestions"
class=
"suggestions"
:class=
"
{ 'align-right': alignRight }"
:class=
"
{ 'align-right': alignRight }"
@mouseleave="unfocus"
@mouseleave="unfocus"
>
>
<li
<li
class=
"suggestion"
v-for=
"(s, i) in suggestions"
v-for=
"(s, i) in suggestions"
:key=
"i"
class=
"suggestion"
:class=
"
{ focused: i === focusIndex }"
:class=
"
{ focused: i === focusIndex }"
@mousedown="go(i)"
@mousedown="go(i)"
@mouseenter="focus(i)"
@mouseenter="focus(i)"
>
>
<a
:href=
"s.path"
@
click.prevent
>
<a
:href=
"s.path"
@
click.prevent
>
<span
class=
"page-title"
>
{{
s
.
title
||
s
.
path
}}
</span>
<span
class=
"page-title"
>
{{
s
.
title
||
s
.
path
}}
</span>
<span
v-if=
"s.header"
class=
"header"
>
>
{{
s
.
header
.
title
}}
</span>
<span
v-if=
"s.header"
class=
"header"
>
>
{{
s
.
header
.
title
}}
</span>
</a>
</a>
</li>
</li>
</ul>
</ul>
...
@@ -40,6 +47,8 @@
...
@@ -40,6 +47,8 @@
<
script
>
<
script
>
/* global SEARCH_MAX_SUGGESTIONS, SEARCH_PATHS, SEARCH_HOTKEYS */
/* global SEARCH_MAX_SUGGESTIONS, SEARCH_PATHS, SEARCH_HOTKEYS */
export
default
{
export
default
{
name
:
'
SearchBox
'
,
data
()
{
data
()
{
return
{
return
{
query
:
''
,
query
:
''
,
...
@@ -49,15 +58,6 @@ export default {
...
@@ -49,15 +58,6 @@ export default {
}
}
},
},
mounted
()
{
this
.
placeholder
=
this
.
$site
.
themeConfig
.
searchPlaceholder
||
''
document
.
addEventListener
(
'
keydown
'
,
this
.
onHotkey
)
},
beforeDestroy
()
{
document
.
removeEventListener
(
'
keydown
'
,
this
.
onHotkey
)
},
computed
:
{
computed
:
{
showSuggestions
()
{
showSuggestions
()
{
return
(
return
(
...
@@ -121,6 +121,15 @@ export default {
...
@@ -121,6 +121,15 @@ export default {
}
}
},
},
mounted
()
{
this
.
placeholder
=
this
.
$site
.
themeConfig
.
searchPlaceholder
||
''
document
.
addEventListener
(
'
keydown
'
,
this
.
onHotkey
)
},
beforeDestroy
()
{
document
.
removeEventListener
(
'
keydown
'
,
this
.
onHotkey
)
},
methods
:
{
methods
:
{
getPageLocalePath
(
page
)
{
getPageLocalePath
(
page
)
{
for
(
const
localePath
in
this
.
$site
.
locales
||
{})
{
for
(
const
localePath
in
this
.
$site
.
locales
||
{})
{
...
...
packages/@vuepress/theme-default/__tests__/components/DropdownLink.spec.js
浏览文件 @
b4853c3e
...
@@ -21,7 +21,7 @@ describe('DropdownLink', () => {
...
@@ -21,7 +21,7 @@ describe('DropdownLink', () => {
const
wrapper
=
mount
(
DropdownLink
,
{
const
wrapper
=
mount
(
DropdownLink
,
{
localVue
:
createLocalVue
(),
localVue
:
createLocalVue
(),
stubs
:
{
stubs
:
{
'
router-l
ink
'
:
RouterLinkStub
'
RouterL
ink
'
:
RouterLinkStub
},
},
propsData
:
{
item
}
propsData
:
{
item
}
})
})
...
...
packages/@vuepress/theme-default/__tests__/components/NavLink.spec.js
浏览文件 @
b4853c3e
...
@@ -11,7 +11,7 @@ describe('NavLink', () => {
...
@@ -11,7 +11,7 @@ describe('NavLink', () => {
const
wrapper
=
mount
(
NavLink
,
{
const
wrapper
=
mount
(
NavLink
,
{
localVue
:
createLocalVue
(),
localVue
:
createLocalVue
(),
stubs
:
{
stubs
:
{
'
router-l
ink
'
:
RouterLinkStub
'
RouterL
ink
'
:
RouterLinkStub
},
},
propsData
:
{
item
}
propsData
:
{
item
}
})
})
...
...
packages/@vuepress/theme-default/components/AlgoliaSearchBox.vue
浏览文件 @
b4853c3e
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
<
script
>
<
script
>
export
default
{
export
default
{
name
:
'
AlgoliaSearchBox
'
,
props
:
[
'
options
'
],
props
:
[
'
options
'
],
data
()
{
data
()
{
...
@@ -22,6 +24,16 @@ export default {
...
@@ -22,6 +24,16 @@ export default {
}
}
},
},
watch
:
{
$lang
(
newValue
)
{
this
.
update
(
this
.
options
,
newValue
)
},
options
(
newValue
)
{
this
.
update
(
newValue
,
this
.
$lang
)
}
},
mounted
()
{
mounted
()
{
this
.
initialize
(
this
.
options
,
this
.
$lang
)
this
.
initialize
(
this
.
options
,
this
.
$lang
)
this
.
placeholder
=
this
.
$site
.
themeConfig
.
searchPlaceholder
||
''
this
.
placeholder
=
this
.
$site
.
themeConfig
.
searchPlaceholder
||
''
...
@@ -58,16 +70,6 @@ export default {
...
@@ -58,16 +70,6 @@ export default {
this
.
$el
.
innerHTML
=
'
<input id="algolia-search-input" class="search-query">
'
this
.
$el
.
innerHTML
=
'
<input id="algolia-search-input" class="search-query">
'
this
.
initialize
(
options
,
lang
)
this
.
initialize
(
options
,
lang
)
}
}
},
watch
:
{
$lang
(
newValue
)
{
this
.
update
(
this
.
options
,
newValue
)
},
options
(
newValue
)
{
this
.
update
(
newValue
,
this
.
$lang
)
}
}
}
}
}
</
script
>
</
script
>
...
...
packages/@vuepress/theme-default/components/DropdownLink.vue
浏览文件 @
b4853c3e
...
@@ -13,44 +13,47 @@
...
@@ -13,44 +13,47 @@
<span
<span
class=
"arrow"
class=
"arrow"
:class=
"open ? 'down' : 'right'"
:class=
"open ? 'down' : 'right'"
></span
>
/
>
</button>
</button>
<DropdownTransition>
<DropdownTransition>
<ul
<ul
class=
"nav-dropdown"
v-show=
"open"
v-show=
"open"
class=
"nav-dropdown"
>
>
<li
<li
class=
"dropdown-item"
:key=
"subItem.link || index"
v-for=
"(subItem, index) in item.items"
v-for=
"(subItem, index) in item.items"
:key=
"subItem.link || index"
class=
"dropdown-item"
>
>
<h4
v-if=
"subItem.type === 'links'"
>
{{
subItem
.
text
}}
</h4>
<h4
v-if=
"subItem.type === 'links'"
>
{{
subItem
.
text
}}
</h4>
<ul
<ul
class=
"dropdown-subitem-wrapper"
v-if=
"subItem.type === 'links'"
v-if=
"subItem.type === 'links'"
class=
"dropdown-subitem-wrapper"
>
>
<li
<li
class=
"dropdown-subitem"
:key=
"childSubItem.link"
v-for=
"childSubItem in subItem.items"
v-for=
"childSubItem in subItem.items"
:key=
"childSubItem.link"
class=
"dropdown-subitem"
>
>
<NavLink
<NavLink
:item=
"childSubItem"
@
focusout=
"
@
focusout=
"
isLastItemOfArray(childSubItem, subItem.items) &&
isLastItemOfArray(childSubItem, subItem.items) &&
isLastItemOfArray(subItem, item.items) &&
isLastItemOfArray(subItem, item.items) &&
setOpen(false)
setOpen(false)
"
"
:item=
"childSubItem"
/>
/>
</li>
</li>
</ul>
</ul>
<NavLink
<NavLink
v-else
v-else
@
focusout=
"isLastItemOfArray(subItem, item.items) && setOpen(false)"
:item=
"subItem"
:item=
"subItem"
@
focusout=
"isLastItemOfArray(subItem, item.items) && setOpen(false)"
/>
/>
</li>
</li>
</ul>
</ul>
...
@@ -64,12 +67,11 @@ import DropdownTransition from '@theme/components/DropdownTransition.vue'
...
@@ -64,12 +67,11 @@ import DropdownTransition from '@theme/components/DropdownTransition.vue'
import
last
from
'
lodash/last
'
import
last
from
'
lodash/last
'
export
default
{
export
default
{
components
:
{
NavLink
,
DropdownTransition
}
,
name
:
'
DropdownLink
'
,
data
()
{
components
:
{
return
{
NavLink
,
open
:
false
DropdownTransition
}
},
},
props
:
{
props
:
{
...
@@ -78,13 +80,24 @@ export default {
...
@@ -78,13 +80,24 @@ export default {
}
}
},
},
computed
:
{
data
()
{
return
{
open
:
false
}
},
computed
:
{
dropdownAriaLabel
()
{
dropdownAriaLabel
()
{
return
this
.
item
.
ariaLabel
||
this
.
item
.
text
return
this
.
item
.
ariaLabel
||
this
.
item
.
text
}
}
},
},
watch
:
{
$route
()
{
this
.
open
=
false
}
},
methods
:
{
methods
:
{
setOpen
(
value
)
{
setOpen
(
value
)
{
this
.
open
=
value
this
.
open
=
value
...
@@ -93,12 +106,6 @@ export default {
...
@@ -93,12 +106,6 @@ export default {
isLastItemOfArray
(
item
,
array
)
{
isLastItemOfArray
(
item
,
array
)
{
return
last
(
array
)
===
item
return
last
(
array
)
===
item
}
}
},
watch
:
{
$route
()
{
this
.
open
=
false
}
}
}
}
}
</
script
>
</
script
>
...
...
packages/@vuepress/theme-default/components/DropdownTransition.vue
浏览文件 @
b4853c3e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
@
after-enter=
"unsetHeight"
@
after-enter=
"unsetHeight"
@
before-leave=
"setHeight"
@
before-leave=
"setHeight"
>
>
<slot/>
<slot
/>
</transition>
</transition>
</
template
>
</
template
>
...
...
packages/@vuepress/theme-default/components/Home.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<main
class=
"home"
aria-labelledby=
"main-title"
>
<main
class=
"home"
aria-labelledby=
"main-title"
>
<header
class=
"hero"
>
<header
class=
"hero"
>
<img
<img
v-if=
"data.heroImage"
v-if=
"data.heroImage"
...
@@ -7,15 +10,23 @@
...
@@ -7,15 +10,23 @@
:alt=
"data.heroAlt || 'hero'"
:alt=
"data.heroAlt || 'hero'"
>
>
<h1
v-if=
"data.heroText !== null"
id=
"main-title"
>
{{
data
.
heroText
||
$title
||
'
Hello
'
}}
</h1>
<h1
v-if=
"data.heroText !== null"
id=
"main-title"
>
{{
data
.
heroText
||
$title
||
'
Hello
'
}}
</h1>
<p
v-if=
"data.tagline !== null"
class=
"description"
>
<p
v-if=
"data.tagline !== null"
class=
"description"
>
{{
data
.
tagline
||
$description
||
'
Welcome to your VuePress site
'
}}
{{
data
.
tagline
||
$description
||
'
Welcome to your VuePress site
'
}}
</p>
</p>
<p
<p
class=
"action"
v-if=
"data.actionText && data.actionLink"
v-if=
"data.actionText && data.actionLink"
class=
"action"
>
>
<NavLink
<NavLink
class=
"action-button"
class=
"action-button"
...
@@ -25,24 +36,24 @@
...
@@ -25,24 +36,24 @@
</header>
</header>
<div
<div
class=
"features"
v-if=
"data.features && data.features.length"
v-if=
"data.features && data.features.length"
class=
"features"
>
>
<div
<div
class=
"feature"
v-for=
"(feature, index) in data.features"
v-for=
"(feature, index) in data.features"
:key=
"index"
:key=
"index"
class=
"feature"
>
>
<h2>
{{
feature
.
title
}}
</h2>
<h2>
{{
feature
.
title
}}
</h2>
<p>
{{
feature
.
details
}}
</p>
<p>
{{
feature
.
details
}}
</p>
</div>
</div>
</div>
</div>
<Content
class=
"theme-default-content custom"
/>
<Content
class=
"theme-default-content custom"
/>
<div
<div
class=
"footer"
v-if=
"data.footer"
v-if=
"data.footer"
class=
"footer"
>
>
{{
data
.
footer
}}
{{
data
.
footer
}}
</div>
</div>
...
@@ -53,6 +64,8 @@
...
@@ -53,6 +64,8 @@
import
NavLink
from
'
@theme/components/NavLink.vue
'
import
NavLink
from
'
@theme/components/NavLink.vue
'
export
default
{
export
default
{
name
:
'
Home
'
,
components
:
{
NavLink
},
components
:
{
NavLink
},
computed
:
{
computed
:
{
...
...
packages/@vuepress/theme-default/components/NavLink.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<router-link
<RouterLink
v-if=
"isInternal"
class=
"nav-link"
class=
"nav-link"
:to=
"link"
:to=
"link"
@
focusout.native=
"focusoutAction"
v-if=
"isInternal"
:exact=
"exact"
:exact=
"exact"
>
{{
item
.
text
}}
</router-link>
@
focusout.native=
"focusoutAction"
>
{{
item
.
text
}}
</RouterLink>
<a
<a
v-else
v-else
:href=
"link"
:href=
"link"
@
focusout=
"focusoutAction"
class=
"nav-link external"
class=
"nav-link external"
:target=
"target"
:target=
"target"
:rel=
"rel"
:rel=
"rel"
@
focusout=
"focusoutAction"
>
>
{{
item
.
text
}}
{{
item
.
text
}}
<OutboundLink
v-if=
"isBlankTarget"
/>
<OutboundLink
v-if=
"isBlankTarget"
/>
</a>
</a>
</
template
>
</
template
>
...
@@ -23,6 +25,8 @@
...
@@ -23,6 +25,8 @@
import
{
isExternal
,
isMailto
,
isTel
,
ensureExt
}
from
'
../util
'
import
{
isExternal
,
isMailto
,
isTel
,
ensureExt
}
from
'
../util
'
export
default
{
export
default
{
name
:
'
NavLink
'
,
props
:
{
props
:
{
item
:
{
item
:
{
required
:
true
required
:
true
...
...
packages/@vuepress/theme-default/components/NavLinks.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<nav
<nav
class=
"nav-links"
v-if=
"userLinks.length || repoLink"
v-if=
"userLinks.length || repoLink"
class=
"nav-links"
>
>
<!-- user links -->
<!-- user links -->
<div
<div
class=
"nav-item"
v-for=
"item in userLinks"
v-for=
"item in userLinks"
:key=
"item.link"
:key=
"item.link"
class=
"nav-item"
>
>
<DropdownLink
<DropdownLink
v-if=
"item.type === 'links'"
v-if=
"item.type === 'links'"
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
rel=
"noopener noreferrer"
rel=
"noopener noreferrer"
>
>
{{
repoLabel
}}
{{
repoLabel
}}
<OutboundLink/>
<OutboundLink
/>
</a>
</a>
</nav>
</nav>
</
template
>
</
template
>
...
@@ -39,7 +39,12 @@ import { resolveNavLinkItem } from '../util'
...
@@ -39,7 +39,12 @@ import { resolveNavLinkItem } from '../util'
import
NavLink
from
'
@theme/components/NavLink.vue
'
import
NavLink
from
'
@theme/components/NavLink.vue
'
export
default
{
export
default
{
components
:
{
NavLink
,
DropdownLink
},
name
:
'
NavLinks
'
,
components
:
{
NavLink
,
DropdownLink
},
computed
:
{
computed
:
{
userNav
()
{
userNav
()
{
...
...
packages/@vuepress/theme-default/components/Navbar.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<header
class=
"navbar"
>
<header
class=
"navbar"
>
<SidebarButton
@
toggle-sidebar=
"$emit('toggle-sidebar')"
/>
<SidebarButton
@
toggle-sidebar=
"$emit('toggle-sidebar')"
/>
<
router-l
ink
<
RouterL
ink
:to=
"$localePath"
:to=
"$localePath"
class=
"home-link"
class=
"home-link"
>
>
<img
<img
class=
"logo"
v-if=
"$site.themeConfig.logo"
v-if=
"$site.themeConfig.logo"
class=
"logo"
:src=
"$withBase($site.themeConfig.logo)"
:src=
"$withBase($site.themeConfig.logo)"
:alt=
"$siteTitle"
:alt=
"$siteTitle"
>
>
<span
<span
v-if=
"$siteTitle"
ref=
"siteName"
ref=
"siteName"
class=
"site-name"
class=
"site-name"
v-if=
"$siteTitle"
:class=
"
{ 'can-hide': $site.themeConfig.logo }"
:class=
"
{ 'can-hide': $site.themeConfig.logo }"
>
{{
$siteTitle
}}
</span>
>
{{
$siteTitle
}}
</span>
</
router-l
ink>
</
RouterL
ink>
<div
<div
class=
"links"
class=
"links"
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
v-if=
"isAlgoliaSearch"
v-if=
"isAlgoliaSearch"
:options=
"algolia"
:options=
"algolia"
/>
/>
<SearchBox
v-else-if=
"$site.themeConfig.search !== false && $page.frontmatter.search !== false"
/>
<SearchBox
v-else-if=
"$site.themeConfig.search !== false && $page.frontmatter.search !== false"
/>
<NavLinks
class=
"can-hide"
/>
<NavLinks
class=
"can-hide"
/>
</div>
</div>
</header>
</header>
</
template
>
</
template
>
...
@@ -43,7 +43,14 @@ import SidebarButton from '@theme/components/SidebarButton.vue'
...
@@ -43,7 +43,14 @@ import SidebarButton from '@theme/components/SidebarButton.vue'
import
NavLinks
from
'
@theme/components/NavLinks.vue
'
import
NavLinks
from
'
@theme/components/NavLinks.vue
'
export
default
{
export
default
{
components
:
{
SidebarButton
,
NavLinks
,
SearchBox
,
AlgoliaSearchBox
},
name
:
'
Navbar
'
,
components
:
{
SidebarButton
,
NavLinks
,
SearchBox
,
AlgoliaSearchBox
},
data
()
{
data
()
{
return
{
return
{
...
@@ -51,6 +58,16 @@ export default {
...
@@ -51,6 +58,16 @@ export default {
}
}
},
},
computed
:
{
algolia
()
{
return
this
.
$themeLocaleConfig
.
algolia
||
this
.
$site
.
themeConfig
.
algolia
||
{}
},
isAlgoliaSearch
()
{
return
this
.
algolia
&&
this
.
algolia
.
apiKey
&&
this
.
algolia
.
indexName
}
},
mounted
()
{
mounted
()
{
const
MOBILE_DESKTOP_BREAKPOINT
=
719
// refer to config.styl
const
MOBILE_DESKTOP_BREAKPOINT
=
719
// refer to config.styl
const
NAVBAR_VERTICAL_PADDING
=
parseInt
(
css
(
this
.
$el
,
'
paddingLeft
'
))
+
parseInt
(
css
(
this
.
$el
,
'
paddingRight
'
))
const
NAVBAR_VERTICAL_PADDING
=
parseInt
(
css
(
this
.
$el
,
'
paddingLeft
'
))
+
parseInt
(
css
(
this
.
$el
,
'
paddingRight
'
))
...
@@ -64,16 +81,6 @@ export default {
...
@@ -64,16 +81,6 @@ export default {
}
}
handleLinksWrapWidth
()
handleLinksWrapWidth
()
window
.
addEventListener
(
'
resize
'
,
handleLinksWrapWidth
,
false
)
window
.
addEventListener
(
'
resize
'
,
handleLinksWrapWidth
,
false
)
},
computed
:
{
algolia
()
{
return
this
.
$themeLocaleConfig
.
algolia
||
this
.
$site
.
themeConfig
.
algolia
||
{}
},
isAlgoliaSearch
()
{
return
this
.
algolia
&&
this
.
algolia
.
apiKey
&&
this
.
algolia
.
indexName
}
}
}
}
}
...
...
packages/@vuepress/theme-default/components/PageEdit.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<footer
class=
"page-edit"
>
<footer
class=
"page-edit"
>
<div
class=
"edit-link"
v-if=
"editLink"
>
<div
<a
:href=
"editLink"
target=
"_blank"
rel=
"noopener noreferrer"
>
{{
editLinkText
}}
</a>
v-if=
"editLink"
class=
"edit-link"
>
<a
:href=
"editLink"
target=
"_blank"
rel=
"noopener noreferrer"
>
{{
editLinkText
}}
</a>
<OutboundLink
/>
<OutboundLink
/>
</div>
</div>
<div
class=
"last-updated"
v-if=
"lastUpdated"
>
<div
v-if=
"lastUpdated"
class=
"last-updated"
>
<span
class=
"prefix"
>
{{
lastUpdatedText
}}
:
</span>
<span
class=
"prefix"
>
{{
lastUpdatedText
}}
:
</span>
<span
class=
"time"
>
{{
lastUpdated
}}
</span>
<span
class=
"time"
>
{{
lastUpdated
}}
</span>
</div>
</div>
</footer>
</footer>
</
template
>
</
template
>
<
script
>
<
script
>
import
isNil
from
'
lodash/isNil
'
import
isNil
from
'
lodash/isNil
'
import
{
endingSlashRE
,
outboundRE
}
from
'
../util
'
import
{
endingSlashRE
,
outboundRE
}
from
'
../util
'
export
default
{
export
default
{
name
:
'
PageEdit
'
,
name
:
'
PageEdit
'
,
computed
:
{
computed
:
{
lastUpdated
()
{
lastUpdated
()
{
return
this
.
$page
.
lastUpdated
return
this
.
$page
.
lastUpdated
...
@@ -94,6 +106,7 @@ export default {
...
@@ -94,6 +106,7 @@ export default {
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"stylus"
>
<
style
lang=
"stylus"
>
@require '../styles/wrapper.styl'
@require '../styles/wrapper.styl'
...
...
packages/@vuepress/theme-default/components/PageNav.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<div
class=
"page-nav"
v-if=
"prev || next"
>
<div
v-if=
"prev || next"
class=
"page-nav"
>
<p
class=
"inner"
>
<p
class=
"inner"
>
<span
v-if=
"prev"
class=
"prev"
>
<span
v-if=
"prev"
class=
"prev"
>
←
←
<a
v-if=
"prev.type === 'external'"
class=
"prev"
:href=
"prev.path"
target=
"_blank"
rel=
'noopener noreferrer'
>
{{
prev
.
title
||
prev
.
path
}}
<OutboundLink
/></a>
<a
<router-link
v-else
class=
"prev"
:to=
"prev.path"
>
{{
prev
.
title
||
prev
.
path
}}
</router-link>
v-if=
"prev.type === 'external'"
class=
"prev"
:href=
"prev.path"
target=
"_blank"
rel=
"noopener noreferrer"
>
{{
prev
.
title
||
prev
.
path
}}
<OutboundLink
/>
</a>
<RouterLink
v-else
class=
"prev"
:to=
"prev.path"
>
{{
prev
.
title
||
prev
.
path
}}
</RouterLink>
</span>
</span>
<span
v-if=
"next"
class=
"next"
>
<span
<a
v-if=
"next.type === 'external'"
:href=
"next.path"
target=
"_blank"
rel=
'noopener noreferrer'
>
{{
next
.
title
||
next
.
path
}}
<OutboundLink
/></a>
v-if=
"next"
<router-link
v-else
:to=
"next.path"
>
{{
next
.
title
||
next
.
path
}}
</router-link>
class=
"next"
>
<a
v-if=
"next.type === 'external'"
:href=
"next.path"
target=
"_blank"
rel=
"noopener noreferrer"
>
{{
next
.
title
||
next
.
path
}}
<OutboundLink
/>
</a>
<RouterLink
v-else
:to=
"next.path"
>
{{
next
.
title
||
next
.
path
}}
</RouterLink>
→
→
</span>
</span>
</p>
</p>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
resolvePage
}
from
'
../util
'
import
{
resolvePage
}
from
'
../util
'
import
isString
from
'
lodash/isString
'
import
isString
from
'
lodash/isString
'
...
@@ -22,7 +64,9 @@ import isNil from 'lodash/isNil'
...
@@ -22,7 +64,9 @@ import isNil from 'lodash/isNil'
export
default
{
export
default
{
name
:
'
PageNav
'
,
name
:
'
PageNav
'
,
props
:
[
'
sidebarItems
'
],
props
:
[
'
sidebarItems
'
],
computed
:
{
computed
:
{
prev
()
{
prev
()
{
return
resolvePageLink
(
LINK_TYPES
.
PREV
,
this
)
return
resolvePageLink
(
LINK_TYPES
.
PREV
,
this
)
...
@@ -116,5 +160,4 @@ function flatten (items, res) {
...
@@ -116,5 +160,4 @@ function flatten (items, res) {
overflow auto // clear float
overflow auto // clear float
.next
.next
float right
float right
</
style
>
</
style
>
packages/@vuepress/theme-default/components/Sidebar.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<aside
class=
"sidebar"
>
<aside
class=
"sidebar"
>
<NavLinks/>
<NavLinks
/>
<slot
name=
"top"
/>
<SidebarLinks
:depth=
"0"
:items=
"items"
/>
<slot
name=
"top"
/>
<slot
name=
"bottom"
/>
<SidebarLinks
:depth=
"0"
:items=
"items"
/>
<slot
name=
"bottom"
/>
</aside>
</aside>
</
template
>
</
template
>
...
...
packages/@vuepress/theme-default/components/SidebarButton.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<div
class=
"sidebar-button"
@
click=
"$emit('toggle-sidebar')"
>
<div
<svg
class=
"icon"
xmlns=
"http://www.w3.org/2000/svg"
aria-hidden=
"true"
role=
"img"
viewBox=
"0 0 448 512"
>
class=
"sidebar-button"
<path
fill=
"currentColor"
d=
"M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"
class=
""
></path>
@
click=
"$emit('toggle-sidebar')"
>
<svg
class=
"icon"
xmlns=
"http://www.w3.org/2000/svg"
aria-hidden=
"true"
role=
"img"
viewBox=
"0 0 448 512"
>
<path
fill=
"currentColor"
d=
"M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"
class=
""
/>
</svg>
</svg>
</div>
</div>
</
template
>
</
template
>
...
...
packages/@vuepress/theme-default/components/SidebarGroup.vue
浏览文件 @
b4853c3e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
`depth-${depth}`
`depth-${depth}`
]"
]"
>
>
<
router-l
ink
<
RouterL
ink
v-if=
"item.path"
v-if=
"item.path"
class=
"sidebar-heading clickable"
class=
"sidebar-heading clickable"
:class=
"
{
:class=
"
{
...
@@ -21,11 +21,11 @@
...
@@ -21,11 +21,11 @@
>
>
<span>
{{
item
.
title
}}
</span>
<span>
{{
item
.
title
}}
</span>
<span
<span
class=
"arrow"
v-if=
"collapsable"
v-if=
"collapsable"
:class=
"open ? 'down' : 'right'"
>
class=
"arrow"
</span>
:class=
"open ? 'down' : 'right'"
</router-link>
/>
</RouterLink>
<p
<p
v-else
v-else
...
@@ -35,18 +35,18 @@
...
@@ -35,18 +35,18 @@
>
>
<span>
{{
item
.
title
}}
</span>
<span>
{{
item
.
title
}}
</span>
<span
<span
class=
"arrow"
v-if=
"collapsable"
v-if=
"collapsable"
:class=
"open ? 'down' : 'right'"
>
class=
"arrow"
</span>
:class=
"open ? 'down' : 'right'"
/>
</p>
</p>
<DropdownTransition>
<DropdownTransition>
<SidebarLinks
<SidebarLinks
v-if=
"open || !collapsable"
class=
"sidebar-group-items"
class=
"sidebar-group-items"
:items=
"item.children"
:items=
"item.children"
v-if=
"open || !collapsable"
:sidebar-depth=
"item.sidebarDepth"
:sidebarDepth=
"item.sidebarDepth"
:depth=
"depth + 1"
:depth=
"depth + 1"
/>
/>
</DropdownTransition>
</DropdownTransition>
...
@@ -59,12 +59,23 @@ import DropdownTransition from '@theme/components/DropdownTransition.vue'
...
@@ -59,12 +59,23 @@ import DropdownTransition from '@theme/components/DropdownTransition.vue'
export
default
{
export
default
{
name
:
'
SidebarGroup
'
,
name
:
'
SidebarGroup
'
,
props
:
[
'
item
'
,
'
open
'
,
'
collapsable
'
,
'
depth
'
],
components
:
{
DropdownTransition
},
components
:
{
DropdownTransition
},
props
:
[
'
item
'
,
'
open
'
,
'
collapsable
'
,
'
depth
'
],
// ref: https://vuejs.org/v2/guide/components-edge-cases.html#Circular-References-Between-Components
// ref: https://vuejs.org/v2/guide/components-edge-cases.html#Circular-References-Between-Components
beforeCreate
()
{
beforeCreate
()
{
this
.
$options
.
components
.
SidebarLinks
=
require
(
'
@theme/components/SidebarLinks.vue
'
).
default
this
.
$options
.
components
.
SidebarLinks
=
require
(
'
@theme/components/SidebarLinks.vue
'
).
default
},
},
methods
:
{
isActive
}
methods
:
{
isActive
}
}
}
</
script
>
</
script
>
...
...
packages/@vuepress/theme-default/components/SidebarLink.vue
浏览文件 @
b4853c3e
...
@@ -73,7 +73,7 @@ function renderLink (h, to, text, active, level) {
...
@@ -73,7 +73,7 @@ function renderLink (h, to, text, active, level) {
}
}
}
}
return
h
(
'
router-l
ink
'
,
component
,
text
)
return
h
(
'
RouterL
ink
'
,
component
,
text
)
}
}
function
renderChildren
(
h
,
children
,
path
,
route
,
maxDepth
,
depth
=
1
)
{
function
renderChildren
(
h
,
children
,
path
,
route
,
maxDepth
,
depth
=
1
)
{
...
...
packages/@vuepress/theme-default/components/SidebarLinks.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<ul
<ul
class=
"sidebar-links"
v-if=
"items.length"
v-if=
"items.length"
class=
"sidebar-links"
>
>
<li
v-for=
"(item, i) in items"
:key=
"i"
>
<li
v-for=
"(item, i) in items"
:key=
"i"
>
<SidebarGroup
<SidebarGroup
v-if=
"item.type === 'group'"
v-if=
"item.type === 'group'"
:item=
"item"
:item=
"item"
...
@@ -14,7 +17,7 @@
...
@@ -14,7 +17,7 @@
/>
/>
<SidebarLink
<SidebarLink
v-else
v-else
:sidebar
D
epth=
"sidebarDepth"
:sidebar
-d
epth=
"sidebarDepth"
:item=
"item"
:item=
"item"
/>
/>
</li>
</li>
...
@@ -43,16 +46,16 @@ export default {
...
@@ -43,16 +46,16 @@ export default {
}
}
},
},
created
()
{
this
.
refreshIndex
()
},
watch
:
{
watch
:
{
'
$route
'
()
{
'
$route
'
()
{
this
.
refreshIndex
()
this
.
refreshIndex
()
}
}
},
},
created
()
{
this
.
refreshIndex
()
},
methods
:
{
methods
:
{
refreshIndex
()
{
refreshIndex
()
{
const
index
=
resolveOpenGroupIndex
(
const
index
=
resolveOpenGroupIndex
(
...
...
packages/@vuepress/theme-default/layouts/404.vue
浏览文件 @
b4853c3e
...
@@ -2,8 +2,12 @@
...
@@ -2,8 +2,12 @@
<div
class=
"theme-container"
>
<div
class=
"theme-container"
>
<div
class=
"theme-default-content"
>
<div
class=
"theme-default-content"
>
<h1>
404
</h1>
<h1>
404
</h1>
<blockquote>
{{
getMsg
()
}}
</blockquote>
<blockquote>
{{
getMsg
()
}}
</blockquote>
<router-link
to=
"/"
>
Take me home.
</router-link>
<RouterLink
to=
"/"
>
Take me home.
</RouterLink>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
...
packages/@vuepress/theme-default/layouts/Layout.vue
浏览文件 @
b4853c3e
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
<div
<div
class=
"sidebar-mask"
class=
"sidebar-mask"
@
click=
"toggleSidebar(false)"
@
click=
"toggleSidebar(false)"
></div
>
/
>
<Sidebar
<Sidebar
:items=
"sidebarItems"
:items=
"sidebarItems"
...
@@ -23,21 +23,21 @@
...
@@ -23,21 +23,21 @@
<slot
name=
"sidebar-top"
/>
<slot
name=
"sidebar-top"
/>
</
template
>
</
template
>
<
template
#bottom
>
<
template
#bottom
>
<slot
name=
"sidebar-bottom"
/>
<slot
name=
"sidebar-bottom"
/>
</
template
>
</
template
>
</Sidebar>
</Sidebar>
<Home
v-if=
"$page.frontmatter.home"
/>
<Home
v-if=
"$page.frontmatter.home"
/>
<Page
<Page
v-else
v-else
:sidebar-items=
"sidebarItems"
:sidebar-items=
"sidebarItems"
>
>
<
template
#top
>
<
template
#top
>
<slot
name=
"page-top"
/>
<slot
name=
"page-top"
/>
</
template
>
</
template
>
<
template
#bottom
>
<
template
#bottom
>
<slot
name=
"page-bottom"
/>
<slot
name=
"page-bottom"
/>
</
template
>
</
template
>
</Page>
</Page>
</div>
</div>
...
@@ -51,7 +51,14 @@ import Sidebar from '@theme/components/Sidebar.vue'
...
@@ -51,7 +51,14 @@ import Sidebar from '@theme/components/Sidebar.vue'
import
{
resolveSidebarItems
}
from
'
../util
'
import
{
resolveSidebarItems
}
from
'
../util
'
export
default
{
export
default
{
components
:
{
Home
,
Page
,
Sidebar
,
Navbar
},
name
:
'
Layout
'
,
components
:
{
Home
,
Page
,
Sidebar
,
Navbar
},
data
()
{
data
()
{
return
{
return
{
...
...
packages/@vuepress/theme-vue/components/BuySellAds.vue
浏览文件 @
b4853c3e
...
@@ -3,11 +3,17 @@
...
@@ -3,11 +3,17 @@
const
ID
=
'
bsa-cpc-script
'
const
ID
=
'
bsa-cpc-script
'
export
default
{
export
default
{
render
(
h
)
{
name
:
'
BuySellAds
'
,
return
h
(
'
div
'
,
{
class
:
'
bsa-cpc-wrapper
'
},
[
h
(
'
div
'
,
{
ref
:
'
ads
'
,
class
:
'
bsa-cpc
'
})
watch
:
{
])
'
$route
'
(
to
,
from
)
{
if
(
to
.
path
!==
from
.
path
)
{
this
.
$refs
.
ads
.
innerHTML
=
''
this
.
load
()
}
}
},
},
mounted
()
{
mounted
()
{
if
(
!
document
.
getElementById
(
ID
))
{
if
(
!
document
.
getElementById
(
ID
))
{
const
s
=
document
.
createElement
(
'
script
'
)
const
s
=
document
.
createElement
(
'
script
'
)
...
@@ -21,14 +27,7 @@ export default {
...
@@ -21,14 +27,7 @@ export default {
this
.
load
()
this
.
load
()
}
}
},
},
watch
:
{
'
$route
'
(
to
,
from
)
{
if
(
to
.
path
!==
from
.
path
)
{
this
.
$refs
.
ads
.
innerHTML
=
''
this
.
load
()
}
}
},
methods
:
{
methods
:
{
load
()
{
load
()
{
if
(
typeof
_bsa
!==
'
undefined
'
&&
_bsa
)
{
if
(
typeof
_bsa
!==
'
undefined
'
&&
_bsa
)
{
...
@@ -39,6 +38,12 @@ export default {
...
@@ -39,6 +38,12 @@ export default {
})
})
}
}
}
}
},
render
(
h
)
{
return
h
(
'
div
'
,
{
class
:
'
bsa-cpc-wrapper
'
},
[
h
(
'
div
'
,
{
ref
:
'
ads
'
,
class
:
'
bsa-cpc
'
})
])
}
}
}
}
</
script
>
</
script
>
...
...
packages/@vuepress/theme-vue/components/CarbonAds.vue
浏览文件 @
b4853c3e
<
script
>
<
script
>
export
default
{
export
default
{
render
(
h
)
{
name
:
'
CarbonAds
'
,
return
h
(
'
div
'
,
{
class
:
'
carbon-ads
'
})
},
mounted
()
{
this
.
load
()
},
watch
:
{
watch
:
{
'
$route
'
(
to
,
from
)
{
'
$route
'
(
to
,
from
)
{
if
(
if
(
...
@@ -20,6 +16,11 @@ export default {
...
@@ -20,6 +16,11 @@ export default {
}
}
}
}
},
},
mounted
()
{
this
.
load
()
},
methods
:
{
methods
:
{
load
()
{
load
()
{
const
s
=
document
.
createElement
(
'
script
'
)
const
s
=
document
.
createElement
(
'
script
'
)
...
@@ -27,6 +28,10 @@ export default {
...
@@ -27,6 +28,10 @@ export default {
s
.
src
=
`//cdn.carbonads.com/carbon.js?serve=CKYIK2QU&placement=vuejsorg`
s
.
src
=
`//cdn.carbonads.com/carbon.js?serve=CKYIK2QU&placement=vuejsorg`
this
.
$el
.
appendChild
(
s
)
this
.
$el
.
appendChild
(
s
)
}
}
},
render
(
h
)
{
return
h
(
'
div
'
,
{
class
:
'
carbon-ads
'
})
}
}
}
}
</
script
>
</
script
>
...
...
packages/@vuepress/theme-vue/layouts/Layout.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<ParentLayout>
<ParentLayout>
<template
#sidebar-top
>
<template
#sidebar-top
>
<CarbonAds/>
<CarbonAds
/>
</
template
>
</
template
>
<
template
#page-bottom
>
<
template
#page-bottom
>
<BuySellAds/>
<BuySellAds
/>
</
template
>
</
template
>
</ParentLayout>
</ParentLayout>
</template>
</template>
...
@@ -15,6 +15,8 @@ import CarbonAds from '@theme/components/CarbonAds.vue'
...
@@ -15,6 +15,8 @@ import CarbonAds from '@theme/components/CarbonAds.vue'
import
BuySellAds
from
'
@theme/components/BuySellAds.vue
'
import
BuySellAds
from
'
@theme/components/BuySellAds.vue
'
export
default
{
export
default
{
name
:
'
Layout
'
,
components
:
{
components
:
{
ParentLayout
,
ParentLayout
,
CarbonAds
,
CarbonAds
,
...
...
packages/docs/docs/.vuepress/components/Bit.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<p
class=
"bit-sponsor"
>
<p
class=
"bit-sponsor"
>
<a
href=
"https://www.bitsrc.io/?utm_source=vue&utm_medium=vue&utm_campaign=vue&utm_term=vue&utm_content=vue"
target=
"_blank"
>
<a
href=
"https://www.bitsrc.io/?utm_source=vue&utm_medium=vue&utm_campaign=vue&utm_term=vue&utm_content=vue"
target=
"_blank"
>
<span>
This project is sponsored by
</span>
<span>
This project is sponsored by
</span>
<img
alt=
"bit"
src=
"https://raw.githubusercontent.com/vuejs/vuejs.org/master/themes/vue/source/images/bit.png"
>
<img
alt=
"bit"
src=
"https://raw.githubusercontent.com/vuejs/vuejs.org/master/themes/vue/source/images/bit.png"
>
</a>
</a>
</p>
</p>
</
template
>
</
template
>
...
...
packages/docs/docs/.vuepress/components/OtherComponent.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<p
class=
"demo"
>
This is another component
</p>
<p
class=
"demo"
>
This is another component
</p>
</
template
>
</
template
>
packages/docs/docs/.vuepress/components/diagram-markdown-slot-relationship.vue
浏览文件 @
b4853c3e
此差异已折叠。
点击以展开。
packages/docs/docs/.vuepress/components/svg-container.vue
浏览文件 @
b4853c3e
<
template
>
<
template
>
<div
class=
"svg-container"
>
<div
class=
"svg-container"
>
<slot
></slot
>
<slot
/
>
</div>
</div>
</
template
>
</
template
>
<
style
lang=
"stylus"
>
<
style
lang=
"stylus"
>
.svg-container
.svg-container
margin 30px auto
margin 30px auto
text-align center
text-align center
& > svg
& > svg
max-width 100%
max-width 100%
</
style
>
</
style
>
scripts/test.js
浏览文件 @
b4853c3e
...
@@ -29,4 +29,3 @@ createApp({
...
@@ -29,4 +29,3 @@ createApp({
console
.
error
(
err
)
console
.
error
(
err
)
process
.
exit
(
1
)
process
.
exit
(
1
)
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录