File tree Expand file tree Collapse file tree 4 files changed +99
-2
lines changed
examples/transition-example Expand file tree Collapse file tree 4 files changed +99
-2
lines changed Original file line number Diff line number Diff line change
1
+ import Vue from 'vue' ;
2
+ import VueWait from '../../src/vue-wait' ;
3
+
4
+ import main from './main.vue' ;
5
+
6
+ Vue . use ( VueWait ) ;
7
+
8
+ new Vue ( {
9
+ el : '#app' ,
10
+ wait : new VueWait ( { registerComponents : false } ) ,
11
+ render : function ( createElement ) {
12
+ return createElement ( main ) ;
13
+ }
14
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div id =" app" >
3
+ <button @click.prevent =" getUsers" >Get Users</button >
4
+ <div class =" transitions-demo" >
5
+ <div >
6
+ <h2 >With transition</h2 >
7
+ <v-wait for =" users" transition =" fade" mode =" out-in" >
8
+ <template slot="waiting">
9
+ <p >Loading...</p >
10
+ </template >
11
+
12
+ <ul >
13
+ <li >One</li >
14
+ <li >Two</li >
15
+ <li >Three</li >
16
+ <li >Four</li >
17
+ <li >Five</li >
18
+ </ul >
19
+ </v-wait >
20
+ </div >
21
+
22
+ <div >
23
+ <h2 >Without transition</h2 >
24
+ <v-wait for =" users" >
25
+ <template slot="waiting">
26
+ <p >Loading...</p >
27
+ </template >
28
+
29
+ <ul >
30
+ <li >One</li >
31
+ <li >Two</li >
32
+ <li >Three</li >
33
+ <li >Four</li >
34
+ <li >Five</li >
35
+ </ul >
36
+ </v-wait >
37
+ </div >
38
+ </div >
39
+ </div >
40
+ </template >
41
+
42
+ <script >
43
+ export default {
44
+ name: " App" ,
45
+ methods: {
46
+ getUsers () {
47
+ return new Promise (resolve => {
48
+ this .$wait .start (" users" );
49
+ setTimeout (() => {
50
+ resolve ();
51
+ this .$wait .end (" users" );
52
+ }, 5000 );
53
+ });
54
+ }
55
+ }
56
+ };
57
+ </script >
58
+
59
+ <style >
60
+ #app {
61
+ display : flex ;
62
+ flex-direction : column ;
63
+ justify-content : center ;
64
+ }
65
+
66
+ .transitions-demo {
67
+ display : flex ;
68
+ justify-content : space-around ;
69
+ }
70
+
71
+ .fade-enter-active ,
72
+ .fade-leave-active {
73
+ transition : opacity 2s ;
74
+ }
75
+
76
+ .fade-enter ,
77
+ .fade-leave-to {
78
+ opacity : 0 ;
79
+ }
80
+ </style >
Original file line number Diff line number Diff line change 31
31
"test" : " exit 0;" ,
32
32
"precommit" : " lint-staged" ,
33
33
"build" : " cross-env NODE_ENV=production webpack --config webpack.config.js" ,
34
+ "dev-transition" : " poi examples/transition-example/index.js" ,
34
35
"dev-vuex" : " poi examples/vuex-example/index.js" ,
35
36
"dev-vue" : " poi examples/vue-example/index.js" ,
36
37
"dev-wrap" : " poi examples/wrap-example/index.js" ,
Original file line number Diff line number Diff line change 1
1
<template lang="html">
2
- <div >
2
+ <transition :name = ' transition ' :mode = ' mode ' >
3
3
<span v-if =' waitsFor' >
4
4
<slot name =' waiting' ></slot>
5
5
<span v-if='message'>{{ message }}</span>
6
6
</span>
7
7
<slot v-else ></slot>
8
- </div >
8
+ </transition >
9
9
</template >
10
10
<script >
11
11
export default {
12
12
props: {
13
13
visible: Boolean ,
14
+ transition: String ,
15
+ mode: String ,
14
16
for: String ,
15
17
message: String ,
16
18
},
You can’t perform that action at this time.
0 commit comments