-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
48 lines (44 loc) · 1.2 KB
/
app.js
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
Vue.createApp({
data() {
return {
perspective: 100,
rotateX: 0,
rotateY: 0,
rotateZ: 0,
}
},
methods: {
reset() {
console.log('reset button clicked')
this.perspective = 100
this.rotateX = 0
this.rotateY = 0
this.rotateZ = 0
},
copy() {
console.log('copy button clicked')
const el = document.createElement('textarea')
el.setAttribute('readonly', '')
el.style.position = 'absolute'
el.style.left = '-9999px'
// use computed value
el.value = `transform:${this.box.transform}`
document.body.appendChild(el)
el.select()
document.execCommand('copy')
document.body.removeChild(el)
alert('Copied!')
}
},
computed: {
box() {
return {
transform: `perspective(${this.perspective}px)
rotateX(${this.rotateX}deg)
rotateY(${this.rotateY}deg)
rotateZ(${this.rotateZ}deg)
`
}
}
}
}).mount('#app')