-
Notifications
You must be signed in to change notification settings - Fork 12
/
es6.html
98 lines (87 loc) · 2.22 KB
/
es6.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
<!--
* @Author: your name
* @Date: 2021-05-06 12:29:53
* @LastEditTime: 2022-05-30 22:03:36
* @LastEditors: Yao guan shou
* @Description: In User Settings Edit
* @FilePath: /react/es6.html
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<script src="./common/js/ajax.js"></script>
<!--官方提供的 CDN 地址:-->
<script src="./common/js/browser.5.8.38.js"></script>
<!-- <script src="./common/js/react.development.v17.0.2.js"></script>
<script src="./common/js/react-dom.development.v17.0.2.js"></script> -->
<!-- <script src="./common/js/browser-polyfill.5.8.38.js"></script> -->
<script src="./common/js/react.v17.0.2.js"></script>
</head>
<style>
.lsft-box{
float: left;
width: 48%;
height: 100vh;
}
.right-box{
float: right;
width: 48%;
height: 100vh;
}
*{
padding: 0;
margin: 0;
}
.textarea{
font-size: 18px;
display: block;
/* width: 100%;
height: 100vh; */
}
</style>
<body>
<div id="example" class="lsft-box">
<p></p>
</div>
<textarea id="textarea" class='textarea right-box' ></textarea>
<!-- <script src="./es6_code/es6_react_code/demo/functionConpoment.js" type="text/babel"></script> -->
<script src="./es5_code/es5_react_code/01/05mapChildren.js" type="text/babel"></script>
<script>
var oTextarea= document.getElementById('textarea');
setTimeout(() => {
// console.log('code=',code)
// debugger
oTextarea.value=code
// console.log('code=',code)
// debugger
var oldCode = window.localStorage.getItem('code');
// 如果同样代码 则不会在发送请求
if(oldCode===code){
return false
}
window.localStorage.setItem('code',code);
//把代码发送到服务器
ajax({
url: "http://127.0.0.1:5000/createCode",
type: 'post',
data: {
path: '/es5_code/es5_react_code/01/05mapChildren.js',
code: code,
},
dataType: 'json',
timeout: 10000,
contentType: "application/json",
success: function (data) {
console.log('data====',data)
},
//异常处理
error: function (e) {
console.log(e);
}
})
}, 200);
</script>
</body>
</html>