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
| const fMenu = {
| label: "首页",
| value: "/",
| active: true
| };
|
| const state = {
| list: [fMenu]
| };
|
| const getters = {
| // 页面进程列表
| processList: (state: any) => state.list
| };
|
| const actions = {};
|
| const mutations = {
| ADD_PROCESS(state: any, item: any) {
| const index = state.list.findIndex(
| (e: any) => e.value.split("?")[0] === item.value.split("?")[0]
| );
|
| state.list.map((e: any) => {
| e.active = e.value == item.value;
| });
|
| if (index < 0) {
| if (item.value == "/") {
| item.label = fMenu.label;
| }
|
| if (item.label) {
| state.list.push({
| ...item,
| active: true
| });
| }
| } else {
| state.list[index].active = true;
| state.list[index].label = item.label;
| state.list[index].value = item.value;
| }
| },
|
| DEL_PROCESS(state: any, index: number) {
| if (index != 0) {
| state.list.splice(index, 1);
| }
| },
|
| SET_PROCESS(state: any, list: Array<any>) {
| state.list = list;
| },
|
| RESET_PROCESS(state: any) {
| state.list = [fMenu];
| }
| };
|
| export default {
| state,
| getters,
| actions,
| mutations
| };
|
|