-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
62 lines (47 loc) · 1.48 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const app = Vue.createApp({
data() {
return {
perspective:100,
rotateX:0,
rotateY:0,
rotateZ:0,
color:'#8d81f3',
width:150,
height:150
}
},
methods: {
reset(){
this.color='#8d81f3';
this.width=150;
this.height=150;
this.perspective=100;
this.rotateX=0;
this.rotateY=0;
this.rotateZ=0;
},
copy(){
const el = document.createElement('textarea')
el.value = `backgroundColor:${this.boxStyle.backgroundColor} width:${this.boxStyle.width} height:${this.boxStyle.height} transform:${this.boxStyle.transform}`
console.log(el.value);
el.setAttribute('readonly','')
el.style.position="absolute"
el.style.left='-9999999999px'
document.body.appendChild(el)
el.select()
document.execCommand('copy')
document.body.removeChild(el)
}
},
computed:{
boxStyle(){
return{
backgroundColor:this.color,
width:this.width,
height:this.height,
transform:`perspective(${this.perspective}px) rotateX(${this.rotateX}deg) rotateY(${this.rotateY}deg) rotateZ(${this.rotateZ}deg)`
}
}
}
})
app.mount("#app")