-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestMock.html
More file actions
44 lines (38 loc) · 1.15 KB
/
testMock.html
File metadata and controls
44 lines (38 loc) · 1.15 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button class="test">
点击
</button>
<button class="logNoUse">
无用的按钮,用来打印一些测试的东西
</button>
</body>
<script type="module">
const myHeaders = new Headers();
myHeaders.append("User-Agent", "Apifox/1.0.0 (https://apifox.com)");
const requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
document.querySelector('.test').addEventListener('click', () => {
fetch("http://ajax-api.itheima.net/api/province", requestOptions)
.then(response => response.text())
.then(() => {
const myDate = Date.now();
console.log(myDate, 'myDateHtml');
})
.catch(error => console.log('error', error));
console.log('点击了');
})
document.querySelector('.logNoUse').addEventListener('click', () => {
console.log('fgadshojnjlho');
})
</script>
</html>