vite-uni-dev-tool 0.0.10 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +65 -1
  2. package/dev/components/AppInfo/index.vue +36 -0
  3. package/dev/components/CaptureScreen/index.vue +62 -0
  4. package/dev/components/Code/index.vue +7 -4
  5. package/dev/components/ConsoleList/ConsoleItem.vue +24 -3
  6. package/dev/components/ConsoleList/RunJSInput.vue +180 -2
  7. package/dev/components/ConsoleList/index.vue +17 -2
  8. package/dev/components/ConsoleList/staticTips.ts +1145 -0
  9. package/dev/components/DevTool/index.vue +37 -31
  10. package/dev/components/DevToolButton/index.vue +9 -12
  11. package/dev/components/DevToolTitle/index.vue +2 -2
  12. package/dev/components/DevToolWindow/index.vue +230 -112
  13. package/dev/components/JsonPretty/components/Carets/index.vue +10 -14
  14. package/dev/components/JsonPretty/index.vue +2 -0
  15. package/dev/components/NetworkList/NetworkDetail.vue +3 -6
  16. package/dev/components/NetworkList/NetworkItem.vue +21 -8
  17. package/dev/components/NetworkList/index.vue +15 -2
  18. package/dev/components/RouteList/index.vue +12 -1
  19. package/dev/components/SettingList/index.vue +2 -5
  20. package/dev/components/SourceCode/index.vue +231 -0
  21. package/dev/components/Tabs/index.vue +23 -10
  22. package/dev/components/UniEvent/UniEventItem.vue +4 -2
  23. package/dev/components/UniEvent/index.vue +7 -3
  24. package/dev/components/UploadList/UploadDetail.vue +3 -7
  25. package/dev/components/UploadList/UploadItem.vue +7 -1
  26. package/dev/components/UploadList/index.vue +15 -2
  27. package/dev/components/VirtualListPro/index.vue +72 -3
  28. package/dev/components/VuexList/index.vue +2 -2
  29. package/dev/components/WebSocket/WebSocketItem.vue +7 -2
  30. package/dev/components/WebSocket/WebSocketList.vue +3 -6
  31. package/dev/components/WebSocket/index.vue +15 -2
  32. package/dev/const.ts +10 -14
  33. package/dev/devEvent/index.ts +49 -18
  34. package/dev/devIntercept/index.ts +18 -0
  35. package/dev/devStore/index.ts +60 -13
  36. package/dev/devToolInfo/index.ts +26 -0
  37. package/dev/plugins/uniDevTool/uniDevTool.d.ts +9 -1
  38. package/dev/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  39. package/dev/plugins/uniDevTool/uniDevTool.js +36 -36
  40. package/dev/plugins/uniGlobalComponents/uniGlobalComponents.js +7 -7
  41. package/dev/type.ts +34 -0
  42. package/dev/utils/index.ts +5 -0
  43. package/dev/utils/language.ts +8 -3
  44. package/dev/utils/object.ts +10 -2
  45. package/package.json +1 -1
@@ -16,99 +16,143 @@
16
16
  <view style="margin-left: 6px">{{ sizeFormat }}</view>
17
17
  </template> -->
18
18
  </Tabs>
19
- <view class="dev-tool-window-container">
20
- <ConsoleList
21
- :currentConsoleType="currentConsoleType"
22
- :consoleList="consoleList"
23
- :sourceFileServers="sourceFileServers"
24
- :mode="mode"
25
- :useDevSource="useDevSource"
26
- v-if="activeTab === 'Console'"
27
- v-model="searchConsole"
28
- @choose="onConsoleChoose"
29
- @search="onSearchConsole"
30
- @run="onRunJS"
31
- />
32
- <NetworkList
33
- :currentNetworkType="currentNetworkType"
34
- :networkList="networkList"
35
- v-model="searchNetwork"
36
- v-if="activeTab === 'Network'"
37
- @choose="onNetworkChoose"
38
- @search="onSearchNetwork"
39
- />
40
- <UploadList
41
- :currentUploadType="currentUploadType"
42
- :uploadList="uploadList"
43
- v-model="searchUpload"
44
- v-if="activeTab === 'Upload'"
45
- @choose="onUploadChoose"
46
- @search="onSearchUpload"
47
- />
48
- <WebSocket
49
- :wsList="wsList"
50
- :currentWebSocketType="currentWebSocketType"
51
- v-model="searchWs"
52
- v-if="activeTab === 'WebSocket'"
53
- @choose="onWebSocketChoose"
54
- @search="onSearchWs"
55
- />
56
- <Connection
57
- v-if="activeTab === 'Connection'"
58
- :netWorkStatus="netWorkStatus"
59
- />
60
- <RouteList
61
- v-if="activeTab === 'Route'"
62
- :routeList="routeList"
63
- v-model="searchRoute"
64
- @goTo="onGoTo"
65
- @search="onSearchRoute"
66
- @routeRefresh="onRouteRefresh"
67
- />
68
- <UniEvent
69
- v-if="activeTab === 'UniEvent'"
70
- :eventList="eventList"
71
- :eventCount="eventCount"
72
- :mode="mode"
73
- :useDevSource="useDevSource"
74
- :sourceFileServers="sourceFileServers"
75
- @clear="onUniEventClear"
76
- />
77
- <SettingList
78
- v-if="activeTab === 'Setting'"
79
- :devToolVisible="devToolVisible"
80
- :sizeFormat="sizeFormat"
81
- @showDevButton="onShowDevButton"
82
- @restartDevTool="onRestartDevTool"
83
- @restartApp="onRestartApp"
84
- @exportLog="onExportLog"
85
- @screenshot="onScreenshot"
86
- @clearCache="onClearCache"
87
- @destroyDevTool="onDestroyDevTool"
88
- />
89
- <StorageList
90
- v-if="activeTab === 'Storage'"
91
- v-model:storage-list="storageList"
92
- v-model="searchStorage"
93
- @choose="onStorageChoose"
94
- @remove="onStorageRemove"
95
- @diff-value="onChangeStorage"
96
- @search="onSearchStorage"
97
- />
98
- <VuexList
99
- v-if="activeTab === 'Vuex'"
100
- v-model:vuexList="vuexList"
101
- @diff-value="onChangeVuex"
102
- />
103
- <PiniaList
104
- v-if="activeTab === 'Pinia'"
105
- v-model:pinia-list="piniaList"
106
- @diff-value="onChangePinia"
107
- />
108
- <SystemInfo v-if="activeTab === 'System'" :systemInfo="systemInfo" />
109
- <DeviceInfo v-if="activeTab === 'Device'" :deviceInfo="deviceInfo" />
110
- <WindowInfo v-if="activeTab === 'Window'" :windowInfo="windowInfo" />
111
- </view>
19
+ <swiper
20
+ class="dev-tool-window-container"
21
+ :current="activeTab"
22
+ @change="onChangeSwiper"
23
+ >
24
+ <swiper-item>
25
+ <ConsoleList
26
+ v-if="swiperShow(0)"
27
+ :currentConsoleType="currentConsoleType"
28
+ :consoleList="consoleList"
29
+ :sourceFileServers="sourceFileServers"
30
+ :mode="mode"
31
+ :useDevSource="useDevSource"
32
+ :zIndex="zIndex + 1"
33
+ v-model="searchConsole"
34
+ @choose="onConsoleChoose"
35
+ @search="onSearchConsole"
36
+ @run="onRunJS"
37
+ />
38
+ </swiper-item>
39
+ <swiper-item>
40
+ <Connection v-if="swiperShow(1)" :netWorkStatus="netWorkStatus" />
41
+ </swiper-item>
42
+ <swiper-item>
43
+ <NetworkList
44
+ v-if="swiperShow(2)"
45
+ :currentNetworkType="currentNetworkType"
46
+ :networkList="networkList"
47
+ :zIndex="zIndex + 1"
48
+ v-model="searchNetwork"
49
+ @choose="onNetworkChoose"
50
+ @search="onSearchNetwork"
51
+ />
52
+ </swiper-item>
53
+ <swiper-item>
54
+ <UploadList
55
+ v-if="swiperShow(3)"
56
+ :currentUploadType="currentUploadType"
57
+ :uploadList="uploadList"
58
+ :zIndex="zIndex + 1"
59
+ v-model="searchUpload"
60
+ @choose="onUploadChoose"
61
+ @search="onSearchUpload"
62
+ />
63
+ </swiper-item>
64
+ <swiper-item>
65
+ <WebSocket
66
+ v-if="swiperShow(4)"
67
+ :wsList="wsList"
68
+ :currentWebSocketType="currentWebSocketType"
69
+ :zIndex="zIndex + 1"
70
+ v-model="searchWs"
71
+ @choose="onWebSocketChoose"
72
+ @search="onSearchWs"
73
+ />
74
+ </swiper-item>
75
+ <swiper-item>
76
+ <RouteList
77
+ v-if="swiperShow(5)"
78
+ :routeList="routeList"
79
+ v-model="searchRoute"
80
+ @goTo="onGoTo"
81
+ @search="onSearchRoute"
82
+ @routeRefresh="onRouteRefresh"
83
+ />
84
+ </swiper-item>
85
+ <swiper-item>
86
+ <UniEvent
87
+ v-if="swiperShow(6)"
88
+ :eventList="eventList"
89
+ :eventCount="eventCount"
90
+ :mode="mode"
91
+ :useDevSource="useDevSource"
92
+ :sourceFileServers="sourceFileServers"
93
+ :zIndex="zIndex + 1"
94
+ @clear="onUniEventClear"
95
+ />
96
+ </swiper-item>
97
+ <swiper-item>
98
+ <CaptureScreen
99
+ v-if="swiperShow(7)"
100
+ :captureScreenList="captureScreenList"
101
+ @clear="onCaptureScreenClear"
102
+ />
103
+ </swiper-item>
104
+ <swiper-item>
105
+ <StorageList
106
+ v-if="swiperShow(8)"
107
+ v-model:storage-list="storageList"
108
+ v-model="searchStorage"
109
+ @choose="onStorageChoose"
110
+ @remove="onStorageRemove"
111
+ @diff-value="onChangeStorage"
112
+ @search="onSearchStorage"
113
+ />
114
+ </swiper-item>
115
+ <swiper-item>
116
+ <VuexList
117
+ v-if="swiperShow(9)"
118
+ v-model:vuexList="vuexList"
119
+ @diff-value="onChangeVuex"
120
+ />
121
+ </swiper-item>
122
+ <swiper-item>
123
+ <PiniaList
124
+ v-if="swiperShow(10)"
125
+ v-model:pinia-list="piniaList"
126
+ @diff-value="onChangePinia"
127
+ />
128
+ </swiper-item>
129
+ <swiper-item>
130
+ <WindowInfo v-if="swiperShow(11)" :windowInfo="windowInfo" />
131
+ </swiper-item>
132
+ <swiper-item>
133
+ <DeviceInfo v-if="swiperShow(12)" :deviceInfo="deviceInfo" />
134
+ </swiper-item>
135
+ <swiper-item>
136
+ <SystemInfo v-if="swiperShow(13)" :systemInfo="systemInfo" />
137
+ </swiper-item>
138
+ <swiper-item>
139
+ <AppInfo v-if="swiperShow(14)" :appInfo="appInfo" />
140
+ </swiper-item>
141
+ <swiper-item>
142
+ <SettingList
143
+ v-if="swiperShow(15)"
144
+ :devToolVisible="devToolVisible"
145
+ :sizeFormat="sizeFormat"
146
+ @showDevButton="onShowDevButton"
147
+ @restartDevTool="onRestartDevTool"
148
+ @restartApp="onRestartApp"
149
+ @exportLog="onExportLog"
150
+ @screenshot="onScreenshot"
151
+ @clearCache="onClearCache"
152
+ @destroyDevTool="onDestroyDevTool"
153
+ />
154
+ </swiper-item>
155
+ </swiper>
112
156
  </view>
113
157
  </template>
114
158
 
@@ -130,7 +174,8 @@ import WindowInfo from '../WindowInfo/index.vue';
130
174
  import WebSocket from '../WebSocket/index.vue';
131
175
  import UploadList from '../UploadList/index.vue';
132
176
  import UniEvent from '../UniEvent/index.vue';
133
- import RunJS from '../RunJS/index.vue';
177
+ import AppInfo from '../AppInfo/index.vue';
178
+ import CaptureScreen from '../CaptureScreen/index.vue';
134
179
  import {
135
180
  DEV_BUTTON_SHOW_OR_HIDE,
136
181
  DEV_CONSOLE_CLEAR,
@@ -151,87 +196,113 @@ import {
151
196
  DEV_UPLOAD_CLEAR,
152
197
  DEV_VUEX_CHANGE,
153
198
  DEV_WEBSOCKET_CLEAR,
154
- DEV_WINDOW_INFO,
155
199
  DEV_APP_MESSAGE,
156
200
  DEV_UNI_EVENT_CLEAR,
157
- DEV_RUN_JS_CLEAR,
158
201
  DEV_RUN_JS,
202
+ DEV_CAPTURE_SCREEN_CLEAR,
159
203
  } from '../../const';
160
204
  import { debounce, hightLight } from '../../utils/index';
161
205
  import type { DevTool } from '../../type';
162
206
  import { eventBus } from '../../core';
207
+ import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
163
208
 
164
209
  const items = [
165
210
  {
166
211
  key: 'Console',
167
212
  label: 'Console',
168
213
  value: 'Console',
214
+ index: 0,
169
215
  },
170
216
  {
171
217
  key: 'Connection',
172
218
  label: 'Connection',
173
219
  value: 'Connection',
220
+ index: 1,
174
221
  },
175
222
  {
176
223
  key: 'Network',
177
224
  label: 'Network',
178
225
  value: 'NetWork',
226
+ index: 2,
179
227
  },
180
228
  {
181
229
  key: 'Upload',
182
230
  label: 'Upload',
183
231
  value: 'Upload',
232
+ index: 3,
184
233
  },
185
234
  {
186
235
  key: 'WebSocket',
187
236
  label: 'WebSocket',
188
237
  value: 'WebSocket',
238
+ index: 4,
189
239
  },
190
240
  {
191
241
  key: 'Route',
192
242
  label: 'Route',
193
243
  value: 'Route',
244
+ index: 5,
194
245
  },
195
246
  {
196
247
  key: 'UniEvent',
197
248
  label: 'UniEvent',
198
249
  value: 'UniEvent',
250
+ index: 6,
251
+ },
252
+ {
253
+ key: 'CaptureScreen',
254
+ label: 'CaptureScreen',
255
+ value: 'CaptureScreen',
256
+ index: 7,
199
257
  },
200
258
  {
201
259
  key: 'Storage',
202
260
  label: 'Storage',
203
261
  value: 'Storage',
262
+ index: 8,
204
263
  },
205
264
 
206
265
  {
207
266
  key: 'Vuex',
208
267
  label: 'Vuex',
209
268
  value: 'Vuex',
269
+ index: 9,
210
270
  },
211
271
  {
212
272
  key: 'Pinia',
213
273
  label: 'Pinia',
214
274
  value: 'Pinia',
275
+ index: 10,
215
276
  },
216
277
  {
217
278
  key: 'Window',
218
279
  label: 'Window',
219
280
  value: 'Window',
281
+ index: 11,
220
282
  },
221
283
  {
222
284
  key: 'Device',
223
285
  label: 'Device',
224
286
  value: 'Device',
287
+ index: 12,
225
288
  },
226
289
  {
227
290
  key: 'System',
228
291
  label: 'System',
229
292
  value: 'System',
293
+ index: 13,
294
+ },
295
+ {
296
+ key: 'AppInfo',
297
+ label: 'AppInfo',
298
+ value: 'AppInfo',
299
+ index: 14,
230
300
  },
231
301
  {
232
302
  key: 'Setting',
233
303
  label: 'Setting',
234
304
  value: 'Setting',
305
+ index: 15,
235
306
  },
236
307
  ];
237
308
 
@@ -267,6 +338,8 @@ const deviceInfo = ref<Record<string, any>>({});
267
338
  const windowInfo = ref<Record<string, any>>({});
268
339
  const eventList = ref<DevTool.EventItem[]>([]);
269
340
  const eventCount = ref<DevTool.EventCount>();
341
+ const appInfo = ref<Record<string, any>>({});
342
+ const captureScreenList = ref<DevTool.CaptureScreenItem[]>([]);
270
343
 
271
344
  const netWorkStatus = ref<{
272
345
  isConnected?: boolean;
@@ -276,7 +349,7 @@ const sizeFormat = ref('');
276
349
 
277
350
  const devToolVisible = ref(true);
278
351
 
279
- const activeTab = ref('Console');
352
+ const activeTab = ref(0);
280
353
  const tabScrollLeft = ref(0);
281
354
  const currentConsoleType = ref('all');
282
355
  const currentNetworkType = ref('all');
@@ -290,19 +363,33 @@ const searchWs = ref('');
290
363
  const searchRoute = ref('');
291
364
  const searchStorage = ref('');
292
365
 
293
- const props = defineProps<{
294
- open?: boolean;
295
- data?: DevTool.WindowData;
296
- sourceFileServers?: string[];
297
- mode?: string;
298
- useDevSource?: boolean;
299
- }>();
366
+ const props = withDefaults(
367
+ defineProps<{
368
+ open?: boolean;
369
+ data?: DevTool.WindowData;
370
+ sourceFileServers?: string[];
371
+ mode?: string;
372
+ useDevSource?: boolean;
373
+ zIndex?: number;
374
+ }>(),
375
+ {
376
+ zIndex: 1000,
377
+ },
378
+ );
300
379
 
301
380
  const emits = defineEmits<{
302
381
  (e: 'close'): void;
303
382
  (e: 'sendMessage', data: { type: string; data: Record<string, any> }): void;
304
383
  }>();
305
384
 
385
+ function swiperShow(index: number) {
386
+ const show =
387
+ index == activeTab.value - 1 ||
388
+ index == activeTab.value ||
389
+ index == activeTab.value + 1;
390
+ return show;
391
+ }
392
+
306
393
  const listenPostMessage = (data: DevTool.WindowData) => {
307
394
  if (!props.open) return;
308
395
  if (!isActive) return;
@@ -467,16 +554,25 @@ const listenPostMessage = (data: DevTool.WindowData) => {
467
554
  if (data.sizeFormat) {
468
555
  sizeFormat.value = data.sizeFormat;
469
556
  }
557
+
558
+ if (data.appInfo) {
559
+ appInfo.value = data.appInfo;
560
+ }
561
+
562
+ if (data.captureScreenList) {
563
+ captureScreenList.value = data.captureScreenList;
564
+ }
470
565
  };
471
566
 
472
567
  let isActive = false;
473
568
  onMounted(() => {
474
- const windowInfo = uni.getStorageSync(DEV_WINDOW_INFO);
475
- if (windowInfo) {
476
- activeTab.value = windowInfo?.activeTab || 'Console';
477
- currentConsoleType.value = windowInfo?.currentConsoleType || 'all';
478
- currentNetworkType.value = windowInfo?.currentNetworkType || 'all';
479
- tabScrollLeft.value = windowInfo?.tabScrollLeft || 0;
569
+ const devToolInfo = getDevToolInfo();
570
+
571
+ if (devToolInfo) {
572
+ activeTab.value = devToolInfo?.activeTab || 0;
573
+ currentConsoleType.value = devToolInfo?.currentConsoleType || 'all';
574
+ currentNetworkType.value = devToolInfo?.currentNetworkType || 'all';
575
+ tabScrollLeft.value = devToolInfo?.tabScrollLeft || 0;
480
576
  }
481
577
  if (props.data) {
482
578
  listenPostMessage(props.data);
@@ -497,6 +593,10 @@ onShow(() => {
497
593
  });
498
594
  onHide(() => {
499
595
  isActive = false;
596
+
597
+ setDevToolInfo({
598
+ devToolWindowVisible: false,
599
+ });
500
600
  });
501
601
 
502
602
  /** 发送消息给 uniapp */
@@ -508,7 +608,7 @@ function basicSendMessage(message: {
508
608
  }
509
609
 
510
610
  function setWindowInfo() {
511
- uni.setStorageSync(DEV_WINDOW_INFO, {
611
+ setDevToolInfo({
512
612
  activeTab: activeTab.value,
513
613
  currentConsoleType: currentConsoleType.value,
514
614
  currentNetworkType: currentNetworkType.value,
@@ -527,6 +627,15 @@ function onChangeTabs() {
527
627
  setWindowInfo();
528
628
  }
529
629
 
630
+ function onChangeSwiper({
631
+ detail,
632
+ }: {
633
+ detail: { current: number; source: any };
634
+ }) {
635
+ activeTab.value = detail.current;
636
+ setWindowInfo();
637
+ }
638
+
530
639
  function onScrollTabs(e: any) {
531
640
  tabScrollLeft.value = e.detail.scrollLeft;
532
641
  debounceSetWindowInfo();
@@ -783,6 +892,14 @@ function onUniEventClear() {
783
892
  });
784
893
  }
785
894
 
895
+ function onCaptureScreenClear() {
896
+ captureScreenList.value = [];
897
+ basicSendMessage({
898
+ type: DEV_CAPTURE_SCREEN_CLEAR,
899
+ data: {},
900
+ });
901
+ }
902
+
786
903
  function onGoTo(page: DevTool.Page) {
787
904
  basicSendMessage({
788
905
  type: DEV_PAGE_JUMP,
@@ -889,7 +1006,7 @@ function onChangePinia(value: Record<string, any>) {
889
1006
  position: fixed;
890
1007
  top: 0;
891
1008
  left: 0;
892
- z-index: 1000;
1009
+ z-index: 1001;
893
1010
  /* #ifdef H5 */
894
1011
  padding: 50px 0;
895
1012
  /* #endif */
@@ -929,6 +1046,7 @@ function onChangePinia(value: Record<string, any>) {
929
1046
  height: 0;
930
1047
  background-color: transparent;
931
1048
  }
1049
+
932
1050
  .dev-tool-window::after {
933
1051
  content: '';
934
1052
  }
@@ -1,24 +1,12 @@
1
1
  <template>
2
2
  <view
3
- v-if="isOpen && isClose"
3
+ v-if="isOpen || isClose"
4
4
  :class="`json-pretty-carets json-pretty-carets-${
5
5
  isOpen ? 'open' : 'close'
6
6
  }`"
7
7
  @click="onClick"
8
8
  >
9
- <svg
10
- viewBox="0 0 1024 1024"
11
- focusable="false"
12
- data-icon="caret-down"
13
- width="1em"
14
- height="1em"
15
- fill="currentColor"
16
- aria-hidden="true"
17
- >
18
- <path
19
- d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
20
- ></path>
21
- </svg>
9
+ <view class="json-pretty-caret-down"></view>
22
10
  </view>
23
11
  </template>
24
12
  <script lang="ts" setup>
@@ -60,4 +48,12 @@ function onClick(e: MouseEvent) {
60
48
  .json-pretty-carets-close {
61
49
  transform: rotate(-90deg);
62
50
  }
51
+
52
+ .json-pretty-caret-down {
53
+ margin: 7px 4px;
54
+ border: 3px solid #000;
55
+ border-top-color: transparent;
56
+ border-left-color: transparent;
57
+ transform: rotate(45deg);
58
+ }
63
59
  </style>
@@ -21,6 +21,8 @@
21
21
  :height="state.height"
22
22
  :pageSize="pageSize"
23
23
  :data="flatData"
24
+ scroll-with-animation
25
+ showBackTop
24
26
  >
25
27
  <template v-slot="{ list, start }">
26
28
  <AutoSize
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="network-detail">
2
+ <view class="network-detail" :style="{ zIndex: zIndex }">
3
3
  <view class="network-detail-control">
4
4
  <Tag
5
5
  mode="info"
@@ -81,7 +81,7 @@ import Tag from '../Tag/index.vue';
81
81
  import Empty from '../Empty/index.vue';
82
82
  import CloseButton from '../CloseButton/index.vue';
83
83
  import type { DevTool } from '../../type';
84
- const props = defineProps<{ network: DevTool.NetworkItem }>();
84
+ const props = defineProps<{ network: DevTool.NetworkItem; zIndex?: number }>();
85
85
  const emit = defineEmits<{ (e: 'close'): void }>();
86
86
  const selectItems = [
87
87
  {
@@ -151,13 +151,10 @@ function onClose() {
151
151
  position: fixed;
152
152
  width: 100vw;
153
153
  height: 100vh;
154
- z-index: 1000;
154
+ z-index: 1001;
155
155
  top: 0;
156
156
  left: 0;
157
157
  padding: 0 16px;
158
- /* #ifdef H5 */
159
- padding: 50px 16px;
160
- /* #endif */
161
158
 
162
159
  background-color: rgba(255, 255, 255, 0.95);
163
160
  box-sizing: border-box;
@@ -3,7 +3,7 @@
3
3
  <view class="network-url-row">
4
4
  <Tag mode="info">{{ network.method }}</Tag>
5
5
 
6
- <view class="network-url" v-html="network.url"> </view>
6
+ <view class="network-url" v-html="lastUrl"> </view>
7
7
 
8
8
  <Tag
9
9
  mode="main"
@@ -46,20 +46,32 @@
46
46
  </view>
47
47
  </view>
48
48
  <!-- <Transition name="slide-fade"> -->
49
- <NetworkDetail v-if="showDetail" :network="network" @close="onClose" />
49
+ <NetworkDetail
50
+ v-if="showDetail"
51
+ :network="network"
52
+ :zIndex="zIndex"
53
+ @close="onClose"
54
+ />
50
55
  <!-- </Transition> -->
51
56
  </template>
52
57
 
53
58
  <script lang="ts" setup>
54
- import { ref } from 'vue';
59
+ import { computed, ref } from 'vue';
55
60
  import Tag from '../Tag/index.vue';
56
61
  import NetworkDetail from './NetworkDetail.vue';
57
62
  import { formatDate } from '../../utils';
58
63
  import type { DevTool } from '../../type';
59
- defineProps<{
64
+ const props = defineProps<{
60
65
  network: DevTool.NetworkItem;
66
+ zIndex?: number;
61
67
  }>();
62
68
  const showDetail = ref(false);
69
+
70
+ const lastUrl = computed(() => {
71
+ const start = props.network.url.lastIndexOf('/');
72
+ return props.network.url.slice(start + 1);
73
+ });
74
+
63
75
  function onClose() {
64
76
  showDetail.value = false;
65
77
  }
@@ -70,22 +82,23 @@ function onClose() {
70
82
  border-bottom: 1px solid var(--dev-tool-border-color);
71
83
  font-size: var(--dev-tool-base-font-size);
72
84
  }
73
- .network-item .network-url-row {
85
+ .network-url-row {
74
86
  display: flex;
75
87
  align-items: center;
76
88
  }
77
89
 
78
- .network-item .network-url-row .network-url {
90
+ .network-url {
79
91
  margin-left: 4px;
80
92
  flex: 1;
93
+ white-space: nowrap;
81
94
  overflow: hidden;
82
95
  text-overflow: ellipsis;
83
96
  }
84
- .network-item .network-url-row .network-detail-icon {
97
+ .network-detail-icon {
85
98
  margin-left: auto;
86
99
  }
87
100
 
88
- .network-item .network-info {
101
+ .network-info {
89
102
  display: flex;
90
103
  align-items: center;
91
104
  justify-content: space-between;