Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
计算机应用开发
前端
Vuepress
提交
26c06289
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,发现更多精彩内容 >>
提交
26c06289
编写于
12月 08, 2018
作者:
D
Daniel Castillo
提交者:
ULIVZ
12月 08, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix($core): remove smoothing scroll (close: #1071) (#1075)
上级
3755beb0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
36 deletion
+9
-36
packages/@vuepress/core/lib/app/app.js
packages/@vuepress/core/lib/app/app.js
+9
-1
packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js
.../@vuepress/core/lib/app/root-mixins/updateLoadingState.js
+0
-30
packages/@vuepress/core/package.json
packages/@vuepress/core/package.json
+0
-1
yarn.lock
yarn.lock
+0
-4
未找到文件。
packages/@vuepress/core/lib/app/app.js
浏览文件 @
26c06289
...
...
@@ -62,7 +62,15 @@ export function createApp (isServer) {
base
:
siteData
.
base
,
mode
:
'
history
'
,
fallback
:
false
,
routes
routes
,
scrollBehavior
(
to
,
from
,
savedPosition
)
{
if
(
savedPosition
)
{
return
savedPosition
}
if
(
to
.
path
!==
from
.
path
)
{
return
{
x
:
0
,
y
:
0
}
}
}
})
// redirect /foo to /foo/
...
...
packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js
浏览文件 @
26c06289
import
SmoothScroll
from
'
smooth-scroll/dist/smooth-scroll.js
'
export
default
{
created
()
{
this
.
$vuepress
.
$on
(
'
AsyncMarkdownContentMounted
'
,
()
=>
{
this
.
$vuepress
.
$set
(
'
contentMounted
'
,
true
)
this
.
$smoothScroll
=
new
SmoothScroll
(
'
a[href*="#"]
'
,
{
speed
:
1
,
speedAsDuration
:
true
,
easing
:
'
easeInOutCubic
'
})
if
(
this
.
$route
.
hash
)
{
const
hash
=
decodeURIComponent
(
this
.
$route
.
hash
)
try
{
const
anchor
=
document
.
getElementById
(
hash
.
slice
(
1
))
const
anchorLink
=
anchor
.
querySelector
(
'
a.header-anchor
'
)
setTimeout
(()
=>
{
window
.
scroll
({
top
:
anchorLink
.
offsetTop
-
70
,
left
:
0
,
behavior
:
'
auto
'
})
})
}
catch
(
e
)
{
console
.
error
(
e
)
}
}
})
},
watch
:
{
'
$route.path
'
()
{
this
.
$vuepress
.
$set
(
'
contentMounted
'
,
false
)
this
.
$smoothScroll
.
destroy
()
}
},
beforeDestroy
()
{
this
.
$smoothScroll
.
destroy
()
}
}
packages/@vuepress/core/package.json
浏览文件 @
26c06289
...
...
@@ -55,7 +55,6 @@
"optimize-css-assets-webpack-plugin"
:
"^4.0.0"
,
"portfinder"
:
"^1.0.13"
,
"postcss-loader"
:
"^2.1.5"
,
"smooth-scroll"
:
"^15.0.0"
,
"toml"
:
"^2.3.3"
,
"url-loader"
:
"^1.0.1"
,
"vue"
:
"^2.5.16"
,
...
...
yarn.lock
浏览文件 @
26c06289
...
...
@@ -7606,10 +7606,6 @@ slice-ansi@1.0.0:
dependencies:
is-fullwidth-code-point "^2.0.0"
smooth-scroll@^15.0.0:
version "15.0.0"
resolved "https://registry.yarnpkg.com/smooth-scroll/-/smooth-scroll-15.0.0.tgz#be4f9cb2cc4952d80db6736e5656ed5849305272"
snapdragon-node@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录