19 margin-top: 15px;
20 width: 20px;
21 height: 20px;
22 border-radius: 50%;
23 background: #55ff00;
24 }
25 .nowI{
26 background: #ff0000 !important;
27 }
28
29
30
31
32 { {item.id}}.{ {item.name}}
33
34
35
36
37
38
39 var vm = new Vue({
40 el: “#app”,
41 data: {
42 list: [{
43 id: 1,
44 name: ‘张三’,
45 state: 1
46 },
47 {
48 id: 2,
49 name: ‘李四’,
50 state: 1
51 },
52 {
53 id: 3,
54 name: ‘王五’,
55 state: 1
56 },
57 {
58 id: 4,
59 name: ‘韩梅梅’,
60 state: 1
61 },
62 {
63 id: 5,
64 name: ‘李磊’,
65 state: 1
66 },
67 ]
68 }
69 })
70
71 var webSocket = null;
72 if (‘WebSocket’ in window) {
73 //创建WebSocket对象
74 webSocket = new WebSocket(“ws://localhost:18801/webSocket/” + getUUID());
75
76 //连接成功
77 webSocket.onopen = function() {
78 console.log(“已连接”);
79 webSocket.send(“消息发送测试”)
80 }
81 //接收到消息
82 webSocket.onmessage = function(msg) {
83 //处理消息
84 var serverMsg = msg.data;
85 var t_id = parseInt(serverMsg) //服务端发过来的消息,ID,string需转化为