File tree Expand file tree Collapse file tree 3 files changed +152
-52
lines changed Expand file tree Collapse file tree 3 files changed +152
-52
lines changed Original file line number Diff line number Diff line change 6
6
>
7
7
<div class =" container " >
8
8
9
- <div class =" row justify-content-center" >
9
+ <ul
10
+ class =" nav nav-tabs"
11
+ role =" tablist"
12
+ >
13
+ <li class =" nav-item" >
14
+ <a
15
+ class =" nav-link active"
16
+ data-toggle =" tab"
17
+ href =" #simple"
18
+ role =" tab"
19
+ aria-controls =" profile"
20
+ aria-selected =" true"
21
+ >Simple</a >
22
+ </li >
23
+ </ul >
24
+ <div
25
+ class =" tab-content"
26
+ id =" tab-content"
27
+ >
10
28
11
- <div class =" list-group col-8" >
12
- <h2 >Draggable</h2 >
13
- <draggable
14
- :list =" list"
15
- @start =" dragging=true"
16
- @end =" dragging=false"
17
- >
18
- <div
19
- class =" list-group-item"
20
- v-for =" element in list"
21
- :key =" element.name"
22
- >{{element.name}}</div >
23
- </draggable >
24
- </div >
25
-
26
- </div >
29
+ <div
30
+ class =" tab-pane show active"
31
+ id =" simple"
32
+ role =" tabpanel"
33
+ aria-labelledby =" profile-tab"
34
+ >
27
35
28
- < div class = " row justify-content-center " >
36
+ < simple / >
29
37
30
- <div class =" list-group col-8" >
31
- <h2 >Normal v-for</h2 >
32
- <div >
33
- <div
34
- class =" list-group-item"
35
- v-for =" element in list"
36
- :key =" element.name"
37
- >{{element.name}}</div >
38
- </div >
39
38
</div >
40
- </div >
41
-
42
- <button @click =" add" >Add</button >
43
- <button @click =" replace" >Replace</button >
44
39
40
+ </div >
45
41
</div >
46
42
</div >
47
43
</template >
48
44
49
45
<script >
50
- import draggable from " @/components/Vuedraggable" ;
51
- let id = 1 ;
46
+ import simple from " ./components/simple" ;
52
47
export default {
53
48
name: " app" ,
54
49
components: {
55
- draggable
56
- },
57
- data () {
58
- return {
59
- list: [
60
- { name: " John" , id: 0 },
61
- { name: " Joao" , id: 1 },
62
- { name: " Jean" , id: 2 }
63
- ],
64
- dragging: false
65
- };
66
- },
67
- methods: {
68
- add : function () {
69
- this .list .push ({ name: " Juan " + id, id: id++ });
70
- },
71
- replace : function () {
72
- this .list = [{ name: " Edgard" , id: id++ }];
73
- }
50
+ simple
74
51
}
75
52
};
76
53
</script >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <h2 >{{title}}</h2 >
4
+ <pre >{{valueString}}</pre >
5
+ </div >
6
+ </template >
7
+ <script >
8
+ const props = {
9
+ title: {
10
+ required: true ,
11
+ type: String
12
+ },
13
+ value: {
14
+ required: true
15
+ }
16
+ };
17
+ export default {
18
+ props,
19
+ computed: {
20
+ valueString () {
21
+ return JSON .stringify (this .value , null , 2 );
22
+ }
23
+ }
24
+ };
25
+ </script >
26
+ <style scoped>
27
+ pre {
28
+ text-align : start ;
29
+ }
30
+ </style >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <div class =" row justify-content-center jumbotron" >
4
+
5
+ <div class =" col-2" >
6
+ <div
7
+ class =" btn-group-vertical buttons"
8
+ role =" group"
9
+ aria-label =" Basic example"
10
+ >
11
+ <button
12
+ class =" btn btn-secondary"
13
+ @click =" add"
14
+ >Add</button >
15
+ <button
16
+ class =" btn btn-secondary"
17
+ @click =" replace"
18
+ >Replace</button >
19
+
20
+ </div >
21
+ </div >
22
+
23
+ <div class =" list-group col-6" >
24
+ <h2 >Draggable {{draggingInfo}}</h2 >
25
+
26
+ <draggable
27
+ :list =" list"
28
+ @start =" dragging=true"
29
+ @end =" dragging=false"
30
+ >
31
+ <div
32
+ class =" list-group-item"
33
+ v-for =" element in list"
34
+ :key =" element.name"
35
+ >{{element.name}}</div >
36
+ </draggable >
37
+ </div >
38
+
39
+ <rawDisplayer
40
+ class =" col-3"
41
+ :value =" list"
42
+ title =" List"
43
+ />
44
+
45
+ </div >
46
+
47
+ </div >
48
+ </template >
49
+
50
+ <script >
51
+ import draggable from " @/components/Vuedraggable" ;
52
+ import rawDisplayer from " ./raw-displayer.vue" ;
53
+ let id = 1 ;
54
+ export default {
55
+ name: " simple" ,
56
+ components: {
57
+ draggable,
58
+ rawDisplayer
59
+ },
60
+ data () {
61
+ return {
62
+ list: [
63
+ { name: " John" , id: 0 },
64
+ { name: " Joao" , id: 1 },
65
+ { name: " Jean" , id: 2 }
66
+ ],
67
+ dragging: false
68
+ };
69
+ },
70
+ computed: {
71
+ draggingInfo () {
72
+ return this .dragging ? " under drag" : " " ;
73
+ },
74
+ listString () {
75
+ return JSON .stringify (this .list , null , 2 );
76
+ }
77
+ },
78
+ methods: {
79
+ add : function () {
80
+ this .list .push ({ name: " Juan " + id, id: id++ });
81
+ },
82
+ replace : function () {
83
+ this .list = [{ name: " Edgard" , id: id++ }];
84
+ }
85
+ }
86
+ };
87
+ </script >
88
+ <style scoped>
89
+ .buttons {
90
+ margin-top : 50px ;
91
+ }
92
+ </style >
93
+
You can’t perform that action at this time.
0 commit comments