File tree Expand file tree Collapse file tree 2 files changed +155
-1
lines changed Expand file tree Collapse file tree 2 files changed +155
-1
lines changed Original file line number Diff line number Diff line change 64
64
>Transition</a >
65
65
</li >
66
66
67
+ <li class =" nav-item" >
68
+ <a
69
+ class =" nav-link"
70
+ data-toggle =" tab"
71
+ href =" #transitions"
72
+ role =" tab"
73
+ aria-controls =" profile"
74
+ aria-selected =" false"
75
+ >Transitions</a >
76
+ </li >
77
+
67
78
<li class =" nav-item" >
68
79
<a
69
80
class =" nav-link"
154
165
>
155
166
<transition-example />
156
167
</div >
168
+
169
+ <div
170
+ class =" tab-pane show"
171
+ id =" transitions"
172
+ role =" tabpanel"
173
+ aria-labelledby =" profile-tab"
174
+ >
175
+ <transition-example-2 />
176
+ </div >
157
177
</div >
158
178
</div >
159
179
</div >
@@ -167,6 +187,8 @@ import footerslot from "./components/footerslot";
167
187
import headerslot from " ./components/headerslot" ;
168
188
import handler from " ./components/handler" ;
169
189
import transitionExample from " ./components/transition-example" ;
190
+ import transitionExample2 from " ./components/transition-example-2" ;
191
+
170
192
171
193
export default {
172
194
name: " app" ,
@@ -177,7 +199,8 @@ export default {
177
199
footerslot,
178
200
headerslot,
179
201
handler,
180
- transitionExample
202
+ transitionExample,
203
+ transitionExample2
181
204
}
182
205
};
183
206
</script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" justify-content-center jumbotron" >
3
+ <div class =" row" >
4
+
5
+ <div class =" col-2" >
6
+ <button
7
+ class =" btn btn-secondary button"
8
+ @click =" sort"
9
+ >To original order</button >
10
+ </div >
11
+
12
+ <div class =" col-6" >
13
+ <h3 >Transition</h3 >
14
+ <draggable
15
+ class =" list-group"
16
+ element =" ul"
17
+ v-model =" list"
18
+ :options =" dragOptions"
19
+ @start =" drag = true"
20
+ @end =" drag = false"
21
+ >
22
+ <transition-group
23
+ type =" transition"
24
+ :name =" !drag? 'flip-list' : null"
25
+ >
26
+ <li
27
+ class =" list-group-item"
28
+ v-for =" element in list"
29
+ :key =" element.order"
30
+ >
31
+ <i
32
+ :class ="
33
+ element.fixed ? 'fa fa-anchor' : 'glyphicon glyphicon-pushpin'
34
+ "
35
+ @click =" element.fixed = !element.fixed"
36
+ aria-hidden =" true"
37
+ ></i >
38
+ {{ element.name }}
39
+ </li >
40
+ </transition-group >
41
+ </draggable >
42
+ </div >
43
+
44
+ <rawDisplayer
45
+ class =" col-3"
46
+ :value =" list"
47
+ title =" List"
48
+ />
49
+
50
+ </div >
51
+ </div >
52
+
53
+ </template >
54
+
55
+ <script >
56
+ import draggable from " @/vuedraggable" ;
57
+ import rawDisplayer from " ./raw-displayer.vue" ;
58
+
59
+ const message = [
60
+ " vue.draggable" ,
61
+ " draggable" ,
62
+ " component" ,
63
+ " for" ,
64
+ " vue.js 2.0" ,
65
+ " based" ,
66
+ " on" ,
67
+ " Sortablejs"
68
+ ];
69
+
70
+ export default {
71
+ name: " tranistion-example" ,
72
+ components: {
73
+ draggable,
74
+ rawDisplayer
75
+ },
76
+ data () {
77
+ return {
78
+ list: message .map ((name , index ) => {
79
+ return { name, order: index + 1 , fixed: false };
80
+ }),
81
+ drag: false
82
+ };
83
+ },
84
+ methods: {
85
+ sort (){
86
+ this .list = this .list .sort ((a ,b ) => a .order - b .order );
87
+ }
88
+ },
89
+ computed: {
90
+ dragOptions () {
91
+ return {
92
+ animation: 200 ,
93
+ group: " description" ,
94
+ disabled: false ,
95
+ ghostClass: " ghost"
96
+ };
97
+ }
98
+ }
99
+ };
100
+ </script >
101
+
102
+ <style >
103
+ .button {
104
+ margin-top : 50px ;
105
+ }
106
+
107
+ .flip-list-move {
108
+ transition : transform 0.5s ;
109
+ }
110
+
111
+ .no-move {
112
+ transition : transform 0s ;
113
+ }
114
+
115
+ .ghost {
116
+ opacity : 0.5 ;
117
+ background : #c8ebfb ;
118
+ }
119
+
120
+ .list-group {
121
+ min-height : 20px ;
122
+ }
123
+
124
+ .list-group-item {
125
+ cursor : move ;
126
+ }
127
+
128
+ .list-group-item i {
129
+ cursor : pointer ;
130
+ }
131
+ </style >
You can’t perform that action at this time.
0 commit comments