-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDouble.vue
72 lines (67 loc) · 1.19 KB
/
Double.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
71
72
<template>
<div class="wrap">
<Flipper :flip-key="key">
<Flipped :on-start="handleStart" flip-id="square" v-if="!open">
<div class="square" @click="toggle"></div>
</Flipped>
<Flipped flip-id="square" v-else>
<div class="full-screen-square" @click="toggle"></div>
</Flipped>
</Flipper>
</div>
</template>
<script>
import Flipper from "../src/Flipper";
import Flipped from "../src/Flipped";
export default {
name: "double",
components: {
Flipper,
Flipped
},
data() {
return {
open: false
};
},
methods: {
toggle() {
this.open = !this.open;
},
handleStart(el) {
console.log("Starting", el);
},
handleComplete(el) {
console.log("Complete", el);
}
},
computed: {
key() {
return this.open.toString();
}
}
};
</script>
<style scoped>
.wrap {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.square {
width: 5rem;
height: 5rem;
cursor: pointer;
background-color: #7971ea;
}
.full-screen-square {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
cursor: pointer;
background-color: #ff4c46;
}
</style>