Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
visualcloud
/
Vmatrix-client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b98f5512
authored
Jun 25, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路由动画
parent
f88f75d6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
9 deletions
+77
-9
src/App.vue
+72
-8
src/views/groups/index.vue
+1
-0
src/views/layout/navbar.vue
+4
-1
No files found.
src/App.vue
View file @
b98f5512
<
template
>
<div
id=
"app"
>
<!--
<div
id=
"nav"
>
<router-link
to=
"/"
>
Home
</router-link>
|
<router-link
to=
"/about"
>
About
</router-link>
</div>
-->
<keep-alive>
<router-view/>
</keep-alive>
<transition
:name=
"transitionName"
>
<keep-alive>
<router-view
class=
"child-view"
/>
</keep-alive>
</transition>
</div>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
transitionName
:
''
}
},
watch
:
{
$route
:
function
()
{
let
isBack
=
this
.
$router
.
isBack
if
(
isBack
)
{
this
.
transitionName
=
'slide-right'
console
.
log
(
'slide-right'
)
}
else
{
console
.
log
(
'slide-right'
)
this
.
transitionName
=
'slide-left'
}
// 做完回退动画后,要设置成前进动画,否则下次打开页面动画将还是回退
this
.
$router
.
isBack
=
false
}
},
created
()
{
// var self = this
if
(
window
.
history
&&
window
.
history
.
pushState
)
{
history
.
pushState
(
null
,
null
,
document
.
URL
)
window
.
addEventListener
(
'popstate'
,
()
=>
{
console
.
log
(
'popstate'
)
this
.
$router
.
isBack
=
true
},
false
)
}
}
}
</
script
>
<
style
lang=
"scss"
>
#app
{
...
...
@@ -29,4 +63,34 @@
}
}
}
.child-view
{
transition
:
all
0.4s
cubic-bezier
(
0.55
,
0
,
0.1
,
1
);
-webkit-overflow-scrolling
:
touch
;
}
.slide-left-enter
,
.slide-right-leave-active
{
opacity
:
0
;
-webkit-transform
:
translate
(
250px
,
0
);
transform
:
translate
(
250px
,
0
);
}
.slide-left-leave-to
{
opacity
:
0
;
-webkit-transform
:
translate
(
-50px
,
0
);
transform
:
translate
(
-50px
,
0
);
}
.slide-left-leave-active
,
.slide-right-enter
{
opacity
:
0
;
-webkit-transform
:
translate
(
-250px
,
0
);
transform
:
translate
(
-250px
,
0
);
}
.fade-enter-active
,
.fade-leave-active
{
transition
:
opacity
0.3s
!important
;
}
.fade-enter
,
.fade-leave-to
/* .fade-leave-active below version 2.1.8 */
{
transition
:
opacity
0.3s
!important
;
/* opacity: 0 !important; */
}
</
style
>
src/views/groups/index.vue
View file @
b98f5512
...
...
@@ -112,6 +112,7 @@ export default {
.clear-btn
{
width
:
133px
;
height
:
44px
;
font-size
:
20px
;
margin
:
0
auto
;
line-height
:
44px
;
text-align
:
center
;
...
...
src/views/layout/navbar.vue
View file @
b98f5512
...
...
@@ -3,7 +3,7 @@
@
click-left=
"myonClickLeft"
@
click-right=
"onClickRight"
>
<div
slot=
"right"
>
<van-icon
v-show=
"showNotice"
@
click=
"goNotice"
name=
"chat-o"
size=
"25
"
/>
<van-icon
v-show=
"showNotice"
@
click=
"goNotice"
name=
"chat-o"
class=
"message-icon
"
/>
<slot></slot>
</div>
</van-nav-bar>
...
...
@@ -56,4 +56,7 @@ export default {
.van-nav-bar__title
{
font-size
:
22px
;
}
.message-icon
{
font-size
:
25px
;
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment