Commit be0769d475d4dee22b91116233eefea808b818f6
1 parent
0b1b650d
added move up transition for Notice
#30
Showing
5 changed files
with
68 additions
and
1 deletions
Show diff stats
src/components/notice/index.js
@@ -68,7 +68,7 @@ function notice (type, options) { | @@ -68,7 +68,7 @@ function notice (type, options) { | ||
68 | key: noticeKey.toString(), | 68 | key: noticeKey.toString(), |
69 | duration: duration, | 69 | duration: duration, |
70 | style: {}, | 70 | style: {}, |
71 | - transitionName: 'move-right', | 71 | + transitionName: 'move-notice', |
72 | content: content, | 72 | content: content, |
73 | onClose: onClose, | 73 | onClose: onClose, |
74 | closable: true | 74 | closable: true |
src/styles/animation/move.less
@@ -117,3 +117,45 @@ | @@ -117,3 +117,45 @@ | ||
117 | opacity: 0; | 117 | opacity: 0; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | + | ||
121 | +// specific transition for Notice | ||
122 | + | ||
123 | +.move-motion(move-notice, ivuMoveNotice); | ||
124 | +@import '../components/notice.less'; | ||
125 | + | ||
126 | +@keyframes ivuMoveNoticeIn { | ||
127 | + 0% { | ||
128 | + opacity: 0; | ||
129 | + transform-origin: 0 0; | ||
130 | + transform: translateX(100%); | ||
131 | + } | ||
132 | + 100% { | ||
133 | + opacity: 1; | ||
134 | + transform-origin: 0 0; | ||
135 | + transform: translateX(0%); | ||
136 | + } | ||
137 | +} | ||
138 | + | ||
139 | +@keyframes ivuMoveNoticeOut { | ||
140 | + 0% { | ||
141 | + transform-origin: 0 0; | ||
142 | + transform: translateX(0%); | ||
143 | + opacity: 1; | ||
144 | + } | ||
145 | + 70% { | ||
146 | + transform-origin: 0 0; | ||
147 | + transform: translateX(100%); | ||
148 | + height: auto; | ||
149 | + padding: @notice-padding; | ||
150 | + margin-bottom: @notice-margin-bottom; | ||
151 | + opacity: 0; | ||
152 | + } | ||
153 | + 100% { | ||
154 | + transform-origin: 0 0; | ||
155 | + transform: translateX(100%); | ||
156 | + height: 0; | ||
157 | + padding: 0; | ||
158 | + margin-bottom: 0; | ||
159 | + opacity: 0; | ||
160 | + } | ||
161 | +} |
test/app.vue
@@ -51,6 +51,7 @@ li + li { | @@ -51,6 +51,7 @@ li + li { | ||
51 | <li><a v-link="'/rate'">Rate</a></li> | 51 | <li><a v-link="'/rate'">Rate</a></li> |
52 | <li><a v-link="'/upload'">Upload</a></li> | 52 | <li><a v-link="'/upload'">Upload</a></li> |
53 | <li><a v-link="'/tree'">Tree</a></li> | 53 | <li><a v-link="'/tree'">Tree</a></li> |
54 | + <li><a v-link="'/notice'">Notice</a></li> | ||
54 | </ul> | 55 | </ul> |
55 | </nav> | 56 | </nav> |
56 | <router-view></router-view> | 57 | <router-view></router-view> |
test/main.js
@@ -155,6 +155,11 @@ router.map({ | @@ -155,6 +155,11 @@ router.map({ | ||
155 | require(['./routers/tree.vue'], resolve); | 155 | require(['./routers/tree.vue'], resolve); |
156 | } | 156 | } |
157 | }, | 157 | }, |
158 | + '/notice': { | ||
159 | + component: function (resolve) { | ||
160 | + require(['./routers/notice.vue'], resolve); | ||
161 | + } | ||
162 | + }, | ||
158 | }); | 163 | }); |
159 | 164 | ||
160 | router.beforeEach(function () { | 165 | router.beforeEach(function () { |
1 | +<template> | ||
2 | + <i-button @click="pop">Pop</i-button> | ||
3 | +</template> | ||
4 | +<script> | ||
5 | + export default { | ||
6 | + methods: { | ||
7 | + pop () { | ||
8 | + for (let i = 0; i < 6; i++) { | ||
9 | + setTimeout(() => { | ||
10 | + this.$Notice.open({ | ||
11 | + title: 'test', | ||
12 | + duration: 1.5 + i | ||
13 | + }); | ||
14 | + }, i * 500); | ||
15 | + } | ||
16 | + } | ||
17 | + } | ||
18 | + } | ||
19 | +</script> |