Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计算机应用开发
前端
Vuepress
提交
ece2e1e0
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,体验更适合开发者的 AI 搜索 >>
提交
ece2e1e0
编写于
12月 13, 2018
作者:
U
ULIVZ
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix($core): "slotKey" must be defined as props in user's markdown's script tag (close: #975)
上级
a56c3b4b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
23 addition
and
42 deletion
+23
-42
packages/@vuepress/core/lib/app/components/Content.js
packages/@vuepress/core/lib/app/components/Content.js
+7
-11
packages/@vuepress/core/lib/app/components/Content.vue
packages/@vuepress/core/lib/app/components/Content.vue
+12
-3
packages/@vuepress/core/lib/app/plugins/VuePress.d.ts
packages/@vuepress/core/lib/app/plugins/VuePress.d.ts
+1
-1
packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js
.../@vuepress/core/lib/app/root-mixins/updateLoadingState.js
+0
-13
packages/@vuepress/core/lib/internal-plugins/rootMixins.js
packages/@vuepress/core/lib/internal-plugins/rootMixins.js
+1
-2
packages/@vuepress/markdown-loader/index.js
packages/@vuepress/markdown-loader/index.js
+1
-11
packages/@vuepress/plugin-active-header-links/mixin.js
packages/@vuepress/plugin-active-header-links/mixin.js
+1
-1
未找到文件。
packages/@vuepress/core/lib/app/components/Content.js
浏览文件 @
ece2e1e0
import
Vue
from
'
vue
'
export
default
{
functional
:
true
,
props
:
{
pageKey
:
String
,
slotKey
:
String
slotKey
:
{
type
:
String
,
default
:
'
default
'
}
},
render
(
h
,
{
parent
,
props
,
data
}
)
{
const
pageKey
=
props
.
pageKey
||
parent
.
$page
.
key
render
(
h
)
{
const
pageKey
=
this
.
pageKey
||
this
.
$
parent
.
$page
.
key
if
(
Vue
.
$vuepress
.
isPageExists
(
pageKey
))
{
// In SSR, if a component is not registered with the component option
// vue-server-renderer will not be able to resovle it.
...
...
@@ -15,13 +17,7 @@ export default {
Vue
.
$vuepress
.
registerPageAsyncComponent
(
pageKey
)
}
return
h
(
pageKey
,
{
class
:
[
data
.
class
,
data
.
staticClass
],
style
:
data
.
style
,
props
:
{
slotKey
:
props
.
slotKey
||
'
default
'
}
})
return
h
(
pageKey
)
}
return
h
(
''
)
}
...
...
packages/@vuepress/core/lib/app/components/Content.vue
浏览文件 @
ece2e1e0
...
...
@@ -24,7 +24,10 @@ export default {
props
:
{
pageKey
:
String
,
slotKey
:
String
slotKey
:
{
type
:
String
,
default
:
'
default
'
}
},
data
()
{
...
...
@@ -72,6 +75,7 @@ export default {
this
.
noTransition
=
true
return
}
// Start to load unfetched page component.
this
.
layout
=
CONTENT_LOADING_COMPONENT
if
(
this
.
$vuepress
.
isPageExists
(
pageKey
))
{
...
...
@@ -79,13 +83,17 @@ export default {
if
(
!
this
.
$ssrContext
)
{
Promise
.
all
([
this
.
$vuepress
.
loadPageAsyncComponent
(
pageKey
),
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
3
00
))
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
10
00
))
]).
then
(([
comp
])
=>
{
this
.
$vuepress
.
$emit
(
'
AsyncMarkdownAssetLoaded
'
,
this
.
pageKey
)
Vue
.
component
(
pageKey
,
comp
.
default
)
this
.
layout
=
null
setTimeout
(()
=>
{
this
.
layout
=
pageKey
setTimeout
(()
=>
{
this
.
$vuepress
.
$set
(
'
contentMounted
'
,
true
)
this
.
$vuepress
.
$emit
(
'
contentMounted
'
,
this
.
slotKey
)
})
})
})
}
...
...
@@ -99,7 +107,8 @@ export default {
.fade-enter-active
,
.fade-leave-active
{
transition
:
opacity
.2s
;
}
.fade-enter
,
.fade-leave-to
/* .fade-leave-active below version 2.1.8 */
{
.fade-enter
,
.fade-leave-to
{
opacity
:
0
;
}
</
style
>
packages/@vuepress/core/lib/app/plugins/VuePress.d.ts
浏览文件 @
ece2e1e0
...
...
@@ -14,7 +14,7 @@ declare class VuePress extends Store {
}
declare
module
"
vue/types/vue
"
{
interface
Vue
{
export
interface
Vue
{
$vuepress
:
VuePress
;
}
}
packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js
已删除
100644 → 0
浏览文件 @
a56c3b4b
export
default
{
created
()
{
this
.
$vuepress
.
$on
(
'
AsyncMarkdownContentMounted
'
,
()
=>
{
this
.
$vuepress
.
$set
(
'
contentMounted
'
,
true
)
})
},
watch
:
{
'
$route.path
'
()
{
this
.
$vuepress
.
$set
(
'
contentMounted
'
,
false
)
}
}
}
packages/@vuepress/core/lib/internal-plugins/rootMixins.js
浏览文件 @
ece2e1e0
...
...
@@ -7,8 +7,7 @@ module.exports = (options, context, api) => ({
// @internal/root-mixins
async
clientDynamicModules
()
{
const
builtInRootMixins
=
[
path
.
resolve
(
__dirname
,
'
../app/root-mixins/updateMeta.js
'
),
path
.
resolve
(
__dirname
,
'
../app/root-mixins/updateLoadingState.js
'
)
path
.
resolve
(
__dirname
,
'
../app/root-mixins/updateMeta.js
'
)
]
const
rootMixins
=
[
...
...
packages/@vuepress/markdown-loader/index.js
浏览文件 @
ece2e1e0
...
...
@@ -100,18 +100,8 @@ module.exports = function (src) {
const
res
=
(
`<template>\n`
+
`<ContentSlotsDistributor :slot-key="slotKey">
${
html
}
</ContentSlotsDistributor>\n`
+
`<ContentSlotsDistributor :slot-key="
$parent.
slotKey">
${
html
}
</ContentSlotsDistributor>\n`
+
`</template>\n`
+
`<script>
export default {
props: ['slot-key'],
mounted() {
this.$nextTick(function () {
this.$vuepress.$emit('AsyncMarkdownContentMounted', this.slotKey)
})
}
}
</script>`
+
(
hoistedTags
||
[]).
join
(
'
\n
'
)
+
`\n
${
dataBlockString
}
\n`
)
...
...
packages/@vuepress/plugin-active-header-links/mixin.js
浏览文件 @
ece2e1e0
...
...
@@ -42,7 +42,7 @@ function getAnchors (sidebarLinks) {
export
default
{
mounted
()
{
this
.
$vuepress
.
$on
(
'
AsyncMarkdownC
ontentMounted
'
,
(
slotKey
)
=>
{
this
.
$vuepress
.
$on
(
'
c
ontentMounted
'
,
(
slotKey
)
=>
{
if
(
slotKey
===
'
default
'
)
{
window
.
addEventListener
(
'
scroll
'
,
this
.
onScroll
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录