Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
cube-ui
提交
963ea5fc
C
cube-ui
项目概览
DiDi
/
cube-ui
11 个月 前同步成功
通知
34
Star
9078
Fork
1508
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cube-ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
963ea5fc
编写于
1月 03, 2018
作者:
D
dolymood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support nav loading, fix issue #64
上级
09780860
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
112 addition
and
4 deletion
+112
-4
document/common/js/utils.js
document/common/js/utils.js
+5
-1
document/components/home/home.vue
document/components/home/home.vue
+4
-1
document/components/nav-loading/nav-loading.vue
document/components/nav-loading/nav-loading.vue
+93
-0
document/router/routes.js
document/router/routes.js
+10
-2
未找到文件。
document/common/js/utils.js
浏览文件 @
963ea5fc
import
Vue
from
'
vue
'
import
cookie
from
'
js-cookie
'
export
function
setItem
(
k
,
v
)
{
...
...
@@ -32,4 +33,7 @@ export function getCurrentLang() {
}
const
baseUrl
=
process
.
env
.
NODE_ENV
===
'
production
'
?
'
https://didi.github.io/cube-ui/example/#/
'
:
`http://
${
window
.
location
.
hostname
}
:8081/#/`
export
{
baseUrl
}
const
eventHub
=
new
Vue
()
export
{
baseUrl
,
eventHub
}
document/components/home/home.vue
浏览文件 @
963ea5fc
...
...
@@ -13,6 +13,7 @@
</span>
</div>
<div
class=
"router-view"
>
<nav-loading></nav-loading>
<router-view></router-view>
</div>
</div>
...
...
@@ -20,6 +21,7 @@
<
script
>
import
Lang
from
'
../lang/lang.vue
'
import
NavLoading
from
'
../nav-loading/nav-loading.vue
'
export
default
{
data
()
{
return
{
...
...
@@ -34,7 +36,8 @@
}
},
components
:
{
SiteLang
:
Lang
SiteLang
:
Lang
,
NavLoading
},
methods
:
{
toggleNav
()
{
...
...
document/components/nav-loading/nav-loading.vue
0 → 100644
浏览文件 @
963ea5fc
<
template
>
<div
class=
"nav-loading"
:class=
"loadingCls"
></div>
</
template
>
<
script
>
import
{
eventHub
}
from
'
../../common/js/utils
'
export
default
{
data
()
{
return
{
loading
:
false
,
toEnd
:
false
}
},
computed
:
{
loadingCls
()
{
const
cls
=
{}
if
(
this
.
loading
)
{
cls
[
'
nav-loading-ani
'
]
=
true
}
if
(
this
.
toEnd
)
{
cls
[
'
nav-loading-ani-end
'
]
=
true
}
return
cls
}
},
created
()
{
let
tid
let
startTime
eventHub
.
$on
(
'
begin-loading
'
,
()
=>
{
startTime
=
Date
.
now
()
clearTimeout
(
tid
)
this
.
loading
=
true
})
eventHub
.
$on
(
'
finish-loading
'
,
()
=>
{
const
time
=
Date
.
now
()
-
startTime
if
(
time
>
500
)
{
this
.
resetLoading
()
}
else
{
tid
=
setTimeout
(
this
.
resetLoading
,
500
-
time
)
}
})
},
methods
:
{
resetLoading
()
{
this
.
toEnd
=
true
setTimeout
(()
=>
{
this
.
toEnd
=
false
this
.
loading
=
false
},
100
)
}
}
}
</
script
>
<
style
lang=
"stylus"
>
@require "~@/common/stylus/variable.styl"
.nav-loading
z-index: 10
position: absolute
width: 100%
height: 2px
background: #009a61
transform: translateX(-100%)
.nav-loading-ani
animation: navloading 2s linear forwards
.nav-loading-ani-end
animation: navloadingend .1s linear
@keyframes navloading
0%
opacity: 0
transform: translateX(-100%)
20%
opacity: .5
transform: translateX(-60%)
50%
opacity: .8
transform: translateX(-40%)
80%
opacity: .8
transform: translateX(-20%)
100%
opacity: .8
transform: translateX(-10%)
@keyframes navloadingend
0%
opacity: .8
transform: translateX(-10%)
100%
opacity: 0
transform: translateX(0)
</
style
>
document/router/routes.js
浏览文件 @
963ea5fc
import
{
eventHub
}
from
'
../common/js/utils
'
import
menuConfig
from
'
../common/config/menu
'
const
routeMap
=
{}
Object
.
keys
(
menuConfig
).
forEach
((
lang
)
=>
{
const
loadingNotify
=
(
p
)
=>
{
eventHub
.
$emit
(
'
begin-loading
'
)
return
p
.
then
((
r
)
=>
{
eventHub
.
$emit
(
'
finish-loading
'
)
return
r
})
}
const
docsChildrenRoute
=
[]
const
docsRoute
=
{
path
:
'
docs
'
,
redirect
:
'
./docs/introduction
'
,
component
:
()
=>
import
(
`../components/docs/
${
lang
}
.vue`
),
component
:
()
=>
loadingNotify
(
import
(
`../components/docs/
${
lang
}
.vue`
)
),
children
:
docsChildrenRoute
}
routeMap
[
lang
]
=
[
docsRoute
]
...
...
@@ -15,7 +23,7 @@ Object.keys(menuConfig).forEach((lang) => {
getSubList
(
groups
[
name
]).
forEach
((
key
)
=>
{
docsChildrenRoute
.
push
({
path
:
key
,
component
:
()
=>
import
(
`../components/docs/
${
lang
}
/
${
key
}
.md`
)
component
:
()
=>
loadingNotify
(
import
(
`../components/docs/
${
lang
}
/
${
key
}
.md`
)
)
})
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录