项目结构是这样子的,后面的代码关键注释都有,就不重复描述了
1、新建SpringBoot工程,选择web和WebSocket依赖
2、配置application.yml
1
2
3
4
5
6
7
8 .item {
9 display: flex;
10 border-bottom: 1px solid #000000;
11 justify-content: space-between;
12 width: 30%;
13 line-height: 50px;
14 height: 50px;
15 }
16
17 .item span:nth-child(2){
18 margin-right: 10px;
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: