Skip to content

Commit a1c7a00

Browse files
authored
refactor: change router components (#349)
1 parent 20e3ef1 commit a1c7a00

File tree

5 files changed

+40
-32
lines changed

5 files changed

+40
-32
lines changed

src/router/alarm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
import type { RouteRecordRaw } from "vue-router";
1818
import Layout from "@/layout/Index.vue";
19+
import Alarm from "@/views/Alarm.vue";
1920

2021
export const routesAlarm: Array<RouteRecordRaw> = [
2122
{
@@ -33,7 +34,7 @@ export const routesAlarm: Array<RouteRecordRaw> = [
3334
{
3435
path: "/alerting",
3536
name: "Alarm",
36-
component: () => import("@/views/Alarm.vue"),
37+
component: Alarm,
3738
},
3839
],
3940
},

src/router/dashboard.ts

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
*/
1717
import type { RouteRecordRaw } from "vue-router";
1818
import Layout from "@/layout/Index.vue";
19+
import List from "@/views/dashboard/List.vue";
20+
import New from "@/views/dashboard/New.vue";
21+
import Edit from "@/views/dashboard/Edit.vue";
22+
import Widget from "@/views/dashboard/Widget.vue";
1923

2024
export const routesDashboard: Array<RouteRecordRaw> = [
2125
{
@@ -32,7 +36,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
3236
children: [
3337
{
3438
path: "/dashboard/list",
35-
component: () => import("@/views/dashboard/List.vue"),
39+
component: List,
3640
name: "List",
3741
meta: {
3842
i18nKey: "dashboardList",
@@ -42,7 +46,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
4246
},
4347
{
4448
path: "/dashboard/new",
45-
component: () => import("@/views/dashboard/New.vue"),
49+
component: New,
4650
name: "New",
4751
meta: {
4852
i18nKey: "dashboardNew",
@@ -54,26 +58,26 @@ export const routesDashboard: Array<RouteRecordRaw> = [
5458
path: "",
5559
redirect: "/dashboard/:layerId/:entity/:name",
5660
name: "Create",
57-
component: () => import("@/views/dashboard/Edit.vue"),
61+
component: Edit,
5862
meta: {
5963
notShow: true,
6064
},
6165
children: [
6266
{
6367
path: "/dashboard/:layerId/:entity/:name",
64-
component: () => import("@/views/dashboard/Edit.vue"),
68+
component: Edit,
6569
name: "CreateChild",
6670
},
6771
{
6872
path: "/dashboard/:layerId/:entity/:name/tab/:activeTabIndex",
69-
component: () => import("@/views/dashboard/Edit.vue"),
73+
component: Edit,
7074
name: "CreateActiveTabIndex",
7175
},
7276
],
7377
},
7478
{
7579
path: "",
76-
component: () => import("@/views/dashboard/Edit.vue"),
80+
component: Edit,
7781
name: "View",
7882
redirect: "/dashboard/:layerId/:entity/:serviceId/:name",
7983
meta: {
@@ -82,96 +86,96 @@ export const routesDashboard: Array<RouteRecordRaw> = [
8286
children: [
8387
{
8488
path: "/dashboard/:layerId/:entity/:serviceId/:name",
85-
component: () => import("@/views/dashboard/Edit.vue"),
89+
component: Edit,
8690
name: "ViewChild",
8791
},
8892
{
8993
path: "/dashboard/:layerId/:entity/:serviceId/:name/tab/:activeTabIndex",
90-
component: () => import("@/views/dashboard/Edit.vue"),
94+
component: Edit,
9195
name: "ViewActiveTabIndex",
9296
},
9397
],
9498
},
9599
{
96100
path: "",
97101
redirect: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name",
98-
component: () => import("@/views/dashboard/Edit.vue"),
102+
component: Edit,
99103
name: "ViewServiceRelation",
100104
meta: {
101105
notShow: true,
102106
},
103107
children: [
104108
{
105109
path: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name",
106-
component: () => import("@/views/dashboard/Edit.vue"),
110+
component: Edit,
107111
name: "ViewServiceRelation",
108112
},
109113
{
110114
path: "/dashboard/related/:layerId/:entity/:serviceId/:destServiceId/:name/tab/:activeTabIndex",
111-
component: () => import("@/views/dashboard/Edit.vue"),
115+
component: Edit,
112116
name: "ViewServiceRelationActiveTabIndex",
113117
},
114118
],
115119
},
116120
{
117121
path: "",
118122
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:name",
119-
component: () => import("@/views/dashboard/Edit.vue"),
123+
component: Edit,
120124
name: "ViewPod",
121125
meta: {
122126
notShow: true,
123127
},
124128
children: [
125129
{
126130
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name",
127-
component: () => import("@/views/dashboard/Edit.vue"),
131+
component: Edit,
128132
name: "ViewPod",
129133
},
130134
{
131135
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:name/tab/:activeTabIndex",
132-
component: () => import("@/views/dashboard/Edit.vue"),
136+
component: Edit,
133137
name: "ViewPodActiveTabIndex",
134138
},
135139
],
136140
},
137141
{
138142
path: "",
139143
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name",
140-
component: () => import("@/views/dashboard/Edit.vue"),
144+
component: Edit,
141145
name: "ViewProcess",
142146
meta: {
143147
notShow: true,
144148
},
145149
children: [
146150
{
147151
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name",
148-
component: () => import("@/views/dashboard/Edit.vue"),
152+
component: Edit,
149153
name: "ViewProcess",
150154
},
151155
{
152156
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:name/tab/:activeTabIndex",
153-
component: () => import("@/views/dashboard/Edit.vue"),
157+
component: Edit,
154158
name: "ViewProcessActiveTabIndex",
155159
},
156160
],
157161
},
158162
{
159163
path: "",
160164
redirect: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name",
161-
component: () => import("@/views/dashboard/Edit.vue"),
165+
component: Edit,
162166
name: "PodRelation",
163167
meta: {
164168
notShow: true,
165169
},
166170
children: [
167171
{
168172
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name",
169-
component: () => import("@/views/dashboard/Edit.vue"),
173+
component: Edit,
170174
name: "ViewPodRelation",
171175
},
172176
{
173177
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:destServiceId/:destPodId/:name/tab/:activeTabIndex",
174-
component: () => import("@/views/dashboard/Edit.vue"),
178+
component: Edit,
175179
name: "ViewPodRelationActiveTabIndex",
176180
},
177181
],
@@ -180,40 +184,40 @@ export const routesDashboard: Array<RouteRecordRaw> = [
180184
path: "",
181185
redirect:
182186
"/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name",
183-
component: () => import("@/views/dashboard/Edit.vue"),
187+
component: Edit,
184188
name: "ProcessRelation",
185189
meta: {
186190
notShow: true,
187191
},
188192
children: [
189193
{
190194
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name",
191-
component: () => import("@/views/dashboard/Edit.vue"),
195+
component: Edit,
192196
name: "ViewProcessRelation",
193197
},
194198
{
195199
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name/tab/:activeTabIndex",
196-
component: () => import("@/views/dashboard/Edit.vue"),
200+
component: Edit,
197201
name: "ViewProcessRelationActiveTabIndex",
198202
},
199203
{
200204
path: "/dashboard/:layerId/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:name/duration/:duration",
201-
component: () => import("@/views/dashboard/Edit.vue"),
205+
component: Edit,
202206
name: "ViewProcessRelationDuration",
203207
},
204208
],
205209
},
206210
{
207211
path: "",
208212
name: "Widget",
209-
component: () => import("@/views/dashboard/Widget.vue"),
213+
component: Widget,
210214
meta: {
211215
notShow: true,
212216
},
213217
children: [
214218
{
215219
path: "/page/:layer/:entity/:serviceId/:podId/:processId/:destServiceId/:destPodId/:destProcessId/:config/:duration?",
216-
component: () => import("@/views/dashboard/Widget.vue"),
220+
component: Widget,
217221
name: "ViewWidget",
218222
},
219223
],

src/router/layer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import Layout from "@/layout/Index.vue";
1818
import { useAppStoreWithOut } from "@/store/modules/app";
1919
import type { MenuOptions } from "@/types/app";
20+
import Layer from "@/views/Layer.vue";
2021

2122
function layerDashboards() {
2223
const appStore = useAppStoreWithOut();
@@ -47,13 +48,13 @@ function layerDashboards() {
4748
descKey: child.descKey,
4849
i18nKey: child.i18nKey,
4950
},
50-
component: () => import("@/views/Layer.vue"),
51+
component: Layer,
5152
};
5253
route.children.push(d);
5354
const tab = {
5455
name: `${child.name}ActiveTabIndex`,
5556
path: `/${child.path}/tab/:activeTabIndex`,
56-
component: () => import("@/views/Layer.vue"),
57+
component: Layer,
5758
meta: {
5859
notShow: true,
5960
layer: child.layer,
@@ -74,7 +75,7 @@ function layerDashboards() {
7475
descKey: item.descKey,
7576
i18nKey: item.i18nKey,
7677
},
77-
component: () => import("@/views/Layer.vue"),
78+
component: Layer,
7879
},
7980
];
8081
}

src/router/marketplace.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
import type { RouteRecordRaw } from "vue-router";
1818
import Layout from "@/layout/Index.vue";
19+
import Marketplace from "@/views/Marketplace.vue";
1920

2021
export const routesMarketplace: Array<RouteRecordRaw> = [
2122
{
@@ -33,7 +34,7 @@ export const routesMarketplace: Array<RouteRecordRaw> = [
3334
{
3435
path: "/marketplace",
3536
name: "MenusManagement",
36-
component: () => import("@/views/Marketplace.vue"),
37+
component: Marketplace,
3738
},
3839
],
3940
},

src/router/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
import type { RouteRecordRaw } from "vue-router";
1818
import Layout from "@/layout/Index.vue";
19+
import Settings from "@/views/Settings.vue";
1920

2021
export const routesSettings: Array<RouteRecordRaw> = [
2122
{
@@ -33,7 +34,7 @@ export const routesSettings: Array<RouteRecordRaw> = [
3334
{
3435
path: "/settings",
3536
name: "Settings",
36-
component: () => import("@/views/Settings.vue"),
37+
component: Settings,
3738
},
3839
],
3940
},

0 commit comments

Comments
 (0)