Skip to content

Commit 71e0033

Browse files
author
pc-david\david.desmaisons
committed
Adding new example
1 parent ce85dc5 commit 71e0033

File tree

3 files changed

+115
-5
lines changed

3 files changed

+115
-5
lines changed

examples/Transition_example_3.html

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!doctype html>
2+
<html class="no-js" lang="">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="x-ua-compatible" content="ie=edge">
7+
<title>Example ul element</title>
8+
<meta name="description" content="">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
11+
<link rel="stylesheet" href="css/main.css">
12+
</head>
13+
14+
<body>
15+
16+
<div id="main">
17+
<div id="areas">
18+
<div id="columns">
19+
<div class="container-fluid machine-contents list">
20+
<draggable :list="jobs" :options="{group:'a', animation:150}" :no-default-animation-on-drag="true" @start="drag=true" @end="drag=false">
21+
<transition-group :name="!drag? 'list-complete' : null" :class="{'no' : drag}" :css="true">
22+
<div v-for="(job, index) in jobs" :key="job.jobNumber" :class="drag? 'item' : 'list-complete-item'">
23+
<div>
24+
{{ job.jobNumber }}
25+
</div>
26+
<div>
27+
<br>
28+
<button v-on:click="removeJob(jobs, index)">Remove</button>
29+
</div>
30+
</div>
31+
</transition-group>
32+
</draggable>
33+
</div>
34+
35+
<div class="container-fluid machine-contents list">
36+
<draggable :list="jobs2" :options="{group:'a', animation:150}" :no-default-animation-on-drag="true" @start="drag=true" @end="drag=false">
37+
<transition-group :name="!drag? 'list-complete' : null" :class="{'no' : drag}" :css="true">
38+
<div v-for="(job, index) in jobs2" :key="job.jobNumber" :class="drag? 'item' : 'list-complete-item'">
39+
<div>
40+
{{ job.jobNumber }}
41+
</div>
42+
<div>
43+
<br>
44+
<button v-on:click="removeJob(jobs2, index)">Remove</button>
45+
</div>
46+
</div>
47+
</transition-group>
48+
</div>
49+
50+
51+
</div>
52+
</div>
53+
<button v-on:click="add">Add</button>
54+
</div>
55+
<script type="text/javascript" src="libs\vue\dist\vue.js"></script>
56+
<script type="text/javascript" src="libs\Sortable\Sortable.js"></script>
57+
<script type="text/javascript" src="src\vuedraggable.js"></script>
58+
<script type="text/javascript" src="script\transition3.js"></script>
59+
</body>
60+
61+
</html>

examples/css/main.css

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@
4848
height: 60px;
4949
}
5050

51-
/*.list-complete-item.no {
52-
transition: none !important;
53-
}*/
54-
55-
5651
.list-complete-enter, .list-complete-leave-active {
5752
opacity: 0;
5853
height: 0px;
@@ -64,4 +59,21 @@
6459
.machine-contents {
6560
margin-top: 10px;
6661
margin-bottom: 10px;
62+
margin-left: 5%;
63+
margin-right: 5%;
64+
/*width: 45%;*/
6765
}
66+
67+
#areas {
68+
display: flex;
69+
}
70+
71+
#columns {
72+
flex: 1;
73+
}
74+
75+
#columns>.list {
76+
width: 40%;
77+
float: left;
78+
}
79+

examples/script/transition3.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
var count =323;
2+
3+
var vm = new Vue({
4+
el: '#main',
5+
name: 'mfgActivity',
6+
data: {
7+
jobs: [
8+
{
9+
jobNumber: "14037-12"
10+
},
11+
{
12+
jobNumber: "14038-13"
13+
},
14+
{
15+
jobNumber: "14048-15"
16+
}
17+
],
18+
jobs2: [
19+
{
20+
jobNumber: "14055-23"
21+
},
22+
{
23+
jobNumber: "14089-10"
24+
}
25+
],
26+
drag: false
27+
},
28+
methods: {
29+
removeJob: function (arr, index) {
30+
// Remove job from GUI
31+
arr.splice(index, 1);
32+
},
33+
add: function () {
34+
this.jobs.push({jobNumber: "14037-"+ count++})
35+
}
36+
}
37+
})

0 commit comments

Comments
 (0)