File tree Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Expand file tree Collapse file tree 2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html class ="no-js " lang ="">
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < meta http-equiv ="x-ua-compatible " content ="ie=edge ">
6
+ < title > Example two lists</ title >
7
+ < meta name ="description " content ="">
8
+ < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
9
+
10
+ < link rel ="stylesheet " href ="css/main.css ">
11
+ </ head >
12
+ < body >
13
+
14
+ < div id ="main ">
15
+ < h1 > Vue Dragable</ h1 >
16
+
17
+ < div class ="drag ">
18
+ < h2 > List 1 draggable</ h2 >
19
+ < draggable class ="dragArea " v-model ="list1 " :options ="{group:'people'} " @change ="log ">
20
+ < div v-for ="(element, index) in list1 " >
21
+ {{element.name}} {{index}}
22
+ </ div >
23
+ </ draggable >
24
+
25
+ < h2 > List 2 draggable</ h2 >
26
+ < draggable class ="dragArea " v-model ="list2 " :options ="{group:'people'} " @change ="log ">
27
+ < div v-for ="(element, index) in list2 " :key ="index "> {{element.name}}</ div >
28
+ </ draggable >
29
+ </ div >
30
+
31
+ < div class ="normal ">
32
+ < h2 > List 1 v-for</ h2 >
33
+ < div >
34
+ < div v-for ="element in list1 " > {{element.name}}</ div >
35
+ </ div >
36
+
37
+ < h2 > List 2 v-for</ h2 >
38
+ < div >
39
+ < div v-for ="element in list2 " > {{element.name}}</ div >
40
+ </ div >
41
+ </ div >
42
+
43
+ < a href ="index.html "> See basic example</ a >
44
+ < a href ="Two_Lists_Clone.html "> See clone element example</ a >
45
+ < a href ="Two_Lists_Clone_If.html "> See clone v-if element example</ a >
46
+ </ div >
47
+ < script type ="text/javascript " src ="libs\vue\dist\vue.js "> </ script >
48
+ < script type ="text/javascript " src ="libs\Sortable\Sortable.js "> </ script >
49
+ < script type ="text/javascript " src ="src\vuedraggable.js "> </ script >
50
+ < script type ="text/javascript " src ="script\complex2.js "> </ script >
51
+ </ body >
52
+ </ html >
Original file line number Diff line number Diff line change
1
+ var vm = new Vue ( {
2
+ el : "#main" ,
3
+ data : {
4
+ list1 :[ { name :"John" , id :1 } ,
5
+ { name :"Joao" , id :2 } ,
6
+ { name :"Jean" , id :3 } ,
7
+ { name :"Gerard" , id :4 } ] ,
8
+ list2 :[ ]
9
+ } ,
10
+ methods :{
11
+ add : function ( ) {
12
+ this . list . push ( { name :'Juan' } ) ;
13
+ } ,
14
+ replace : function ( ) {
15
+ this . list = [ { name :'Edgard' } ]
16
+ } ,
17
+ clone : function ( el ) {
18
+ return {
19
+ name : el . name + ' cloned'
20
+ }
21
+ } ,
22
+ log : function ( evt ) {
23
+ console . log ( evt )
24
+ }
25
+ }
26
+ } ) ;
You can’t perform that action at this time.
0 commit comments