-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.html
98 lines (87 loc) · 1.98 KB
/
run.html
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Run</title>
<style>
html,body{
padding: 0;
margin:0;
box-sizing: border-box;
height: 100%;
}
textarea,iframe{
width:50%;
height:calc(100% - 50px);
margin-top: 20px;
float:left;
font-size: 20px;
box-sizing: border-box;
}
#run,#vue{
position: absolute;
left: 50%;
margin-left: -3rem;
}
#vue{
left: calc(50% + 50px);
}
</style>
</head>
<textarea id="text" style="display:block;">
<!DOCTYPE html>
<html>
<body>
<head>
<meta charset="utf-8">
<title>Inner</title>
</head>
<div id="app">
</div>
<script>
"use strict"
</script>
</body>
</html>
</textarea>
<textarea id="vueText" style="display:none;">
<!DOCTYPE html>
<html>
<body>
<head>
<meta charset="utf-8">
<title>Inner</title>
</head>
<div id="app">
</div>
<script src="./run/vue.js"></script>
<script>
"use strict"
var Main = {
data () {
return {
name:'Vue'
}
}
}
var Component = Vue.extend(Main)
var app=new Component().$mount('#app')
</script>
</body>
</html>
</textarea>
<button id="run" onclick="run()">RUN</button>
<button id="vue" onclick="openVue()">VUE</button>
<iframe id="frame"></iframe>
<script>
function run(){
// alert(document.getElementById("text").value)
document.getElementById("frame").srcdoc=document.getElementById("text").style.display== 'none'? document.getElementById("vueText").value : document.getElementById("text").value;
}
function openVue(){
document.getElementById("vueText").style.display=document.getElementById("vueText").style.display== 'none'? 'block':'none';
document.getElementById("text").style.display=document.getElementById("text").style.display== 'none'? 'block':'none';
}
</script>
</body>
</html>