-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
52 lines (47 loc) · 1.26 KB
/
test.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
<!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>
<div id="app"></div>
<button id="btn">点击建立socket连接</button>
</body>
</html>
<style>
svg {
stroke: hotpink;
width: 100px !important
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
<script>
btn.onclick = function () {
var socket = io("ws://chst.vip")
socket.on('connect', () => {
console.log('链接成功')
})
socket.on("wepaySuccess", data => {
console.log(data);
})
socket.on("wepayFail", data => {
console.log(data);
})
// fetch("http://chst.vip/users/getScancode")
// .then(res => res.json())
// .then(res => {
// console.log(res);
// })
// socket.on('scancodeSuccess', (data) => {
// console.log(data)
// })
// socket.on('qrcode', (data) => {
// console.log(data)
// })
// socket.on('wechatLoginSuccess', (data) => {
// console.log(data)
// })
}
</script>