-
Notifications
You must be signed in to change notification settings - Fork 545
/
Copy pathmulti-layer-slot-example.vue
70 lines (67 loc) · 1.34 KB
/
multi-layer-slot-example.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
<div>
<button class="btn btn-secondary" @click="onClick">LevelChange</button>
<component :is="slotName" :list="list"> </component>
</div>
</template>
<script>
import DefaultSlot from "./multi-layer-slot/default-slot.vue";
import LevelOneSlot from "./multi-layer-slot/level-one.vue";
import LevelTwoSlot from "./multi-layer-slot/level-two.vue";
import LevelThreeSlot from "./multi-layer-slot/level-three.vue";
export default {
name: "multi-layer-slot-example",
display: "Multi layer slot",
order: 16,
components: {
DefaultSlot,
LevelOneSlot,
LevelTwoSlot,
LevelThreeSlot
},
computed: {
slotName() {
const num = this.levelNum % 4;
switch (num) {
case 0:
return "DefaultSlot";
case 1:
return "LevelOneSlot";
case 2:
return "LevelTwoSlot";
case 3:
return "LevelThreeSlot";
}
return "DefaultSlot";
}
},
data() {
return {
list: [
{ name: "John", id: 0 },
{ name: "Joao", id: 1 },
{ name: "Jean", id: 2 }
],
dragging: false,
levelNum: 0
};
},
methods: {
onClick() {
this.levelNum++;
}
}
};
</script>
<style scoped>
.btn {
margin-bottom: 35px;
}
.ghost {
opacity: 0.5;
background: #c8ebfb;
}
.not-draggable {
cursor: no-drop;
}
</style>