vite-uni-dev-tool 0.0.21 → 0.0.23
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.
- package/README.md +13 -3
- package/dist/const.d.ts +16 -0
- package/dist/const.d.ts.map +1 -1
- package/dist/const.js +29 -25
- package/dist/core.d.ts +3 -3
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +89 -49
- package/dist/devEvent/index.d.ts +34 -0
- package/dist/devEvent/index.d.ts.map +1 -1
- package/dist/devEvent/index.js +71 -27
- package/dist/devIntercept/index.d.ts.map +1 -1
- package/dist/devIntercept/index.js +195 -157
- package/dist/devStore/index.d.ts +9 -0
- package/dist/devStore/index.d.ts.map +1 -1
- package/dist/devStore/index.js +54 -20
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/type.d.ts +22 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/v2/DevTool/index.vue +8 -8
- package/dist/v3/ConsoleList/ConsoleItem.vue +1 -1
- package/dist/v3/DevTool/index.vue +13 -12
- package/dist/v3/DevToolWindow/const.d.ts +30 -0
- package/dist/v3/DevToolWindow/const.d.ts.map +1 -0
- package/dist/v3/DevToolWindow/const.ts +123 -0
- package/dist/v3/DevToolWindow/index.vue +242 -108
- package/dist/v3/NetworkList/InterceptConfig.vue +835 -0
- package/dist/v3/NetworkList/InterceptItem.vue +132 -0
- package/dist/v3/NetworkList/NetworkDetail.vue +25 -13
- package/dist/v3/NetworkList/NetworkIntercept.vue +85 -0
- package/dist/v3/NetworkList/NetworkItem.vue +18 -29
- package/dist/v3/NetworkList/NetworkSend.vue +61 -45
- package/dist/v3/NetworkList/index.vue +11 -67
- package/dist/v3/SettingList/index.vue +26 -2
- package/dist/v3/SettingList/typing.d.ts +2 -0
- package/dist/v3/SourceCode/Line.vue +3 -3
- package/dist/v3/SourceCode/index.vue +1 -2
- package/dist/v3/Tag/index.vue +1 -0
- package/dist/v3/UploadList/UploadDetail.vue +36 -18
- package/dist/v3/UploadList/UploadItem.vue +38 -34
- package/dist/v3/UploadList/index.vue +12 -1
- package/dist/v3/VirtualListPro/index.vue +15 -12
- package/dist/v3/WebSocket/WebSocketDetail.vue +258 -0
- package/dist/v3/WebSocket/WebSocketItem.vue +14 -30
- package/dist/v3/WebSocket/index.vue +6 -1
- package/package.json +1 -1
- package/dist/v3/WebSocket/WebSocketList.vue +0 -161
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<view class="dev-tool-window-bg"></view>
|
|
12
12
|
<Tabs
|
|
13
13
|
v-model="activeTab"
|
|
14
|
-
:items="
|
|
14
|
+
:items="tabItems"
|
|
15
15
|
:scroll-left="tabScrollLeft"
|
|
16
16
|
@close="onCloseWindow"
|
|
17
17
|
@scroll="debounceScrollTabs"
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
@search="onSearchNetwork"
|
|
60
60
|
@sort="onSortNetwork"
|
|
61
61
|
@openCode="onOpenCode"
|
|
62
|
+
@openSend="onOpenNetworkSend"
|
|
63
|
+
@openDetail="onOpenNetworkDetail"
|
|
64
|
+
@openIntercept="onOpenNetworkIntercept"
|
|
62
65
|
/>
|
|
63
66
|
</swiper-item>
|
|
64
67
|
<swiper-item>
|
|
@@ -67,9 +70,13 @@
|
|
|
67
70
|
:currentUploadType="currentUploadType"
|
|
68
71
|
:uploadList="uploadList"
|
|
69
72
|
:zIndex="zIndex + 1"
|
|
73
|
+
:mode="mode"
|
|
74
|
+
:useDevSource="useDevSource"
|
|
70
75
|
v-model="searchUpload"
|
|
71
76
|
@choose="onUploadChoose"
|
|
72
77
|
@search="onSearchUpload"
|
|
78
|
+
@openDetail="onOpenUploadDetail"
|
|
79
|
+
@openCode="onOpenCode"
|
|
73
80
|
/>
|
|
74
81
|
</swiper-item>
|
|
75
82
|
<swiper-item>
|
|
@@ -81,6 +88,8 @@
|
|
|
81
88
|
v-model="searchWs"
|
|
82
89
|
@choose="onWebSocketChoose"
|
|
83
90
|
@search="onSearchWs"
|
|
91
|
+
@openDetail="onOpenWebSocketDetail"
|
|
92
|
+
@openCode="onOpenCode"
|
|
84
93
|
/>
|
|
85
94
|
</swiper-item>
|
|
86
95
|
<swiper-item>
|
|
@@ -171,6 +180,7 @@
|
|
|
171
180
|
:devToolVisible="devToolVisible"
|
|
172
181
|
:sizeFormat="sizeFormat"
|
|
173
182
|
:theme="theme"
|
|
183
|
+
:cacheInterceptConfig="cacheInterceptConfig"
|
|
174
184
|
@showDevButton="onShowDevButton"
|
|
175
185
|
@restartDevTool="onRestartDevTool"
|
|
176
186
|
@restartApp="onRestartApp"
|
|
@@ -179,6 +189,7 @@
|
|
|
179
189
|
@clearCache="onClearCache"
|
|
180
190
|
@destroyDevTool="onDestroyDevTool"
|
|
181
191
|
@changeTheme="onChangeTheme"
|
|
192
|
+
@changeCacheInterceptConfig="onChangeCacheInterceptConfig"
|
|
182
193
|
/>
|
|
183
194
|
</swiper-item>
|
|
184
195
|
</swiper>
|
|
@@ -187,17 +198,71 @@
|
|
|
187
198
|
<SourceCode
|
|
188
199
|
v-if="openCode"
|
|
189
200
|
:url="stack"
|
|
190
|
-
:sourceFileServers="sourceFileServers"
|
|
191
201
|
:mode="mode"
|
|
192
202
|
:zIndex="zIndex"
|
|
203
|
+
:sourceFileServers="sourceFileServers"
|
|
193
204
|
@close="onCloseCode"
|
|
194
205
|
/>
|
|
206
|
+
|
|
207
|
+
<!-- 发起请求 -->
|
|
208
|
+
<NetworkSend
|
|
209
|
+
v-if="showNetworkSend"
|
|
210
|
+
:zIndex="zIndex"
|
|
211
|
+
:network="network"
|
|
212
|
+
:interceptNetworkList="interceptNetworkList"
|
|
213
|
+
@close="onCloseNetworkSend"
|
|
214
|
+
@openDetail="onOpenNetworkDetail"
|
|
215
|
+
/>
|
|
216
|
+
|
|
217
|
+
<!-- 拦截请求 -->
|
|
218
|
+
<NetworkIntercept
|
|
219
|
+
v-if="showNetworkIntercept"
|
|
220
|
+
:zIndex="zIndex"
|
|
221
|
+
:network="network"
|
|
222
|
+
:interceptNetworkList="interceptNetworkList"
|
|
223
|
+
@close="onCloseNetworkIntercept"
|
|
224
|
+
@remove="onRemoveInterceptConfig"
|
|
225
|
+
@openConfig="onOpenInterceptConfig"
|
|
226
|
+
/>
|
|
227
|
+
|
|
228
|
+
<!-- 拦截配置 -->
|
|
229
|
+
<InterceptConfig
|
|
230
|
+
v-if="showInterceptConfig"
|
|
231
|
+
:zIndex="zIndex"
|
|
232
|
+
:network="network"
|
|
233
|
+
@close="onCloseInterceptConfig"
|
|
234
|
+
@confirm="onConfirmInterceptConfig"
|
|
235
|
+
/>
|
|
236
|
+
|
|
237
|
+
<!-- 请求详情 -->
|
|
238
|
+
<NetworkDetail
|
|
239
|
+
v-if="showNetworkDetail"
|
|
240
|
+
:zIndex="zIndex"
|
|
241
|
+
:network="network"
|
|
242
|
+
@close="onCloseNetworkDetail"
|
|
243
|
+
/>
|
|
244
|
+
|
|
245
|
+
<!-- 上传详情 -->
|
|
246
|
+
<UploadDetail
|
|
247
|
+
v-if="showUploadDetail"
|
|
248
|
+
:upload="upload"
|
|
249
|
+
:zIndex="zIndex"
|
|
250
|
+
@close="onCloseUploadDetail"
|
|
251
|
+
/>
|
|
252
|
+
|
|
253
|
+
<WebSocketDetail
|
|
254
|
+
v-if="showWebSocketDetail"
|
|
255
|
+
:ws="currentWebSocket"
|
|
256
|
+
:zIndex="zIndex"
|
|
257
|
+
@close="onCloseWebSocketDetail"
|
|
258
|
+
@clear="onClearWebSocketMessage"
|
|
259
|
+
/>
|
|
195
260
|
</view>
|
|
196
261
|
</template>
|
|
197
262
|
|
|
198
263
|
<script setup lang="ts">
|
|
199
264
|
import { onLoad, onUnload, onShow, onHide } from '@dcloudio/uni-app';
|
|
200
|
-
import { ref, onMounted } from 'vue';
|
|
265
|
+
import { ref, onMounted, reactive, computed, nextTick } from 'vue';
|
|
201
266
|
import Tabs from '../Tabs/index.vue';
|
|
202
267
|
import ConsoleList from '../ConsoleList/index.vue';
|
|
203
268
|
import NetworkList from '../NetworkList/index.vue';
|
|
@@ -217,6 +282,14 @@ import AppInfo from '../AppInfo/index.vue';
|
|
|
217
282
|
import CaptureScreen from '../CaptureScreen/index.vue';
|
|
218
283
|
import SourceCode from '../SourceCode/index.vue';
|
|
219
284
|
|
|
285
|
+
import NetworkSend from '../NetworkList/NetworkSend.vue';
|
|
286
|
+
import NetworkDetail from '../NetworkList/NetworkDetail.vue';
|
|
287
|
+
import NetworkIntercept from '../NetworkList/NetworkIntercept.vue';
|
|
288
|
+
import InterceptConfig from '../NetworkList/InterceptConfig.vue';
|
|
289
|
+
|
|
290
|
+
import UploadDetail from '../UploadList/UploadDetail.vue';
|
|
291
|
+
import WebSocketDetail from '../WebSocket/WebSocketDetail.vue';
|
|
292
|
+
|
|
220
293
|
import {
|
|
221
294
|
DEV_BUTTON_SHOW_OR_HIDE,
|
|
222
295
|
DEV_CONSOLE_CLEAR,
|
|
@@ -241,111 +314,16 @@ import {
|
|
|
241
314
|
DEV_UNI_EVENT_CLEAR,
|
|
242
315
|
DEV_RUN_JS,
|
|
243
316
|
DEV_CAPTURE_SCREEN_CLEAR,
|
|
317
|
+
DEV_INTERCEPT_NETWORK_UPDATE,
|
|
318
|
+
DEV_INTERCEPT_NETWORK_REMOVE,
|
|
319
|
+
DEV_CHANGE_CACHE_INTERCEPT_CONFIG,
|
|
320
|
+
DEV_WEBSOCKET_CLEAR_MESSAGE,
|
|
244
321
|
} from '../../const';
|
|
245
322
|
import { debounce, hightLight, isAndroid, isMockWX } from '../../utils/index';
|
|
246
323
|
import type { DevTool } from '../../type';
|
|
247
324
|
import { eventBus } from '../../core';
|
|
248
325
|
import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
|
|
249
|
-
|
|
250
|
-
const items = [
|
|
251
|
-
{
|
|
252
|
-
key: 'Console',
|
|
253
|
-
label: 'Console',
|
|
254
|
-
value: 'Console',
|
|
255
|
-
index: 0,
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
key: 'Connection',
|
|
259
|
-
label: 'Connection',
|
|
260
|
-
value: 'Connection',
|
|
261
|
-
index: 1,
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
key: 'Network',
|
|
265
|
-
label: 'Network',
|
|
266
|
-
value: 'NetWork',
|
|
267
|
-
index: 2,
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
key: 'Upload',
|
|
271
|
-
label: 'Upload',
|
|
272
|
-
value: 'Upload',
|
|
273
|
-
index: 3,
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
key: 'WebSocket',
|
|
277
|
-
label: 'WebSocket',
|
|
278
|
-
value: 'WebSocket',
|
|
279
|
-
index: 4,
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
key: 'Route',
|
|
283
|
-
label: 'Route',
|
|
284
|
-
value: 'Route',
|
|
285
|
-
index: 5,
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
key: 'UniEvent',
|
|
289
|
-
label: 'UniEvent',
|
|
290
|
-
value: 'UniEvent',
|
|
291
|
-
index: 6,
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
key: 'CaptureScreen',
|
|
295
|
-
label: 'CaptureScreen',
|
|
296
|
-
value: 'CaptureScreen',
|
|
297
|
-
index: 7,
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
key: 'Storage',
|
|
301
|
-
label: 'Storage',
|
|
302
|
-
value: 'Storage',
|
|
303
|
-
index: 8,
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
{
|
|
307
|
-
key: 'Vuex',
|
|
308
|
-
label: 'Vuex',
|
|
309
|
-
value: 'Vuex',
|
|
310
|
-
index: 9,
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
key: 'Pinia',
|
|
314
|
-
label: 'Pinia',
|
|
315
|
-
value: 'Pinia',
|
|
316
|
-
index: 10,
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
key: 'Window',
|
|
320
|
-
label: 'Window',
|
|
321
|
-
value: 'Window',
|
|
322
|
-
index: 11,
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
key: 'Device',
|
|
326
|
-
label: 'Device',
|
|
327
|
-
value: 'Device',
|
|
328
|
-
index: 12,
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
key: 'System',
|
|
332
|
-
label: 'System',
|
|
333
|
-
value: 'System',
|
|
334
|
-
index: 13,
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
key: 'AppInfo',
|
|
338
|
-
label: 'AppInfo',
|
|
339
|
-
value: 'AppInfo',
|
|
340
|
-
index: 14,
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
key: 'Setting',
|
|
344
|
-
label: 'Setting',
|
|
345
|
-
value: 'Setting',
|
|
346
|
-
index: 15,
|
|
347
|
-
},
|
|
348
|
-
];
|
|
326
|
+
import { tabItems, emptyNetwork } from './const';
|
|
349
327
|
|
|
350
328
|
const backup: {
|
|
351
329
|
consoleList: DevTool.ConsoleItem[];
|
|
@@ -381,6 +359,7 @@ const eventList = ref<DevTool.EventItem[]>([]);
|
|
|
381
359
|
const eventCount = ref<DevTool.EventCount>();
|
|
382
360
|
const appInfo = ref<Record<string, any>>({});
|
|
383
361
|
const captureScreenList = ref<DevTool.CaptureScreenItem[]>([]);
|
|
362
|
+
const interceptNetworkList = ref<DevTool.NetworkItem[]>([]);
|
|
384
363
|
|
|
385
364
|
const netWorkStatus = ref<{
|
|
386
365
|
isConnected?: boolean;
|
|
@@ -394,7 +373,7 @@ const activeTab = ref(0);
|
|
|
394
373
|
const tabScrollLeft = ref(0);
|
|
395
374
|
const currentConsoleType = ref('all');
|
|
396
375
|
const currentNetworkType = ref('all');
|
|
397
|
-
const currentNetworkSort = ref
|
|
376
|
+
const currentNetworkSort = ref<1 | -1>(1);
|
|
398
377
|
const currentUploadType = ref('all');
|
|
399
378
|
const currentWebSocketType = ref('all');
|
|
400
379
|
|
|
@@ -408,6 +387,31 @@ const theme = ref('light');
|
|
|
408
387
|
const openCode = ref(false);
|
|
409
388
|
const stack = ref('');
|
|
410
389
|
|
|
390
|
+
const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
|
|
391
|
+
|
|
392
|
+
const showNetworkSend = ref(false);
|
|
393
|
+
const showNetworkDetail = ref(false);
|
|
394
|
+
const showNetworkIntercept = ref(false);
|
|
395
|
+
const showInterceptConfig = ref(false);
|
|
396
|
+
const cacheInterceptConfig = ref(true);
|
|
397
|
+
|
|
398
|
+
const upload = reactive<DevTool.UploadItem>({
|
|
399
|
+
index: 0,
|
|
400
|
+
status: '',
|
|
401
|
+
});
|
|
402
|
+
const showUploadDetail = ref(false);
|
|
403
|
+
|
|
404
|
+
const webSocket = reactive<DevTool.WS>({
|
|
405
|
+
url: '',
|
|
406
|
+
message: [],
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
const currentWebSocket = computed(() => {
|
|
410
|
+
return wsList.value.find((item) => item.url === webSocket.url);
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
const showWebSocketDetail = ref(false);
|
|
414
|
+
|
|
411
415
|
const props = withDefaults(
|
|
412
416
|
defineProps<{
|
|
413
417
|
open?: boolean;
|
|
@@ -479,12 +483,20 @@ const calcNetworkTimeline = (
|
|
|
479
483
|
}) ?? []
|
|
480
484
|
);
|
|
481
485
|
};
|
|
482
|
-
|
|
486
|
+
/**
|
|
487
|
+
* 禁止在该方法中 禁用调用已拦截的方法,防止递归调用
|
|
488
|
+
* - 禁用 uni.setStorage
|
|
489
|
+
* - 禁用 uni.request
|
|
490
|
+
* - 禁用 uni.upload
|
|
491
|
+
* - 禁用导入的 console
|
|
492
|
+
*/
|
|
483
493
|
const listenPostMessage = (data: DevTool.WindowData) => {
|
|
484
494
|
if (!props.open) return;
|
|
485
495
|
if (!isActive) return;
|
|
486
496
|
devToolVisible.value = data.devToolVisible ?? false;
|
|
487
497
|
|
|
498
|
+
cacheInterceptConfig.value = data.cacheInterceptConfig ?? false;
|
|
499
|
+
|
|
488
500
|
if (data.consoleList) {
|
|
489
501
|
consoleList.value = [...(data.consoleList ?? [])]
|
|
490
502
|
.filter((item) => {
|
|
@@ -645,6 +657,7 @@ const listenPostMessage = (data: DevTool.WindowData) => {
|
|
|
645
657
|
if (data.deviceInfo) {
|
|
646
658
|
deviceInfo.value = data.deviceInfo;
|
|
647
659
|
}
|
|
660
|
+
|
|
648
661
|
if (data.windowInfo) {
|
|
649
662
|
windowInfo.value = data.windowInfo;
|
|
650
663
|
}
|
|
@@ -664,6 +677,10 @@ const listenPostMessage = (data: DevTool.WindowData) => {
|
|
|
664
677
|
if (data.captureScreenList) {
|
|
665
678
|
captureScreenList.value = data.captureScreenList;
|
|
666
679
|
}
|
|
680
|
+
|
|
681
|
+
if (data.interceptNetworkMap) {
|
|
682
|
+
interceptNetworkList.value = Array.from(data.interceptNetworkMap.values());
|
|
683
|
+
}
|
|
667
684
|
};
|
|
668
685
|
|
|
669
686
|
let isActive = false;
|
|
@@ -688,11 +705,11 @@ onMounted(() => {
|
|
|
688
705
|
|
|
689
706
|
onLoad(() => {
|
|
690
707
|
isActive = true;
|
|
691
|
-
eventBus
|
|
708
|
+
eventBus?.on(DEV_APP_MESSAGE, listenPostMessage);
|
|
692
709
|
});
|
|
693
710
|
onUnload(() => {
|
|
694
711
|
isActive = false;
|
|
695
|
-
eventBus
|
|
712
|
+
eventBus?.off(DEV_APP_MESSAGE, listenPostMessage);
|
|
696
713
|
});
|
|
697
714
|
|
|
698
715
|
onShow(() => {
|
|
@@ -722,6 +739,8 @@ function setWindowInfo() {
|
|
|
722
739
|
currentNetworkType: currentNetworkType.value,
|
|
723
740
|
currentWebSocketType: currentWebSocketType.value,
|
|
724
741
|
tabScrollLeft: tabScrollLeft.value,
|
|
742
|
+
cacheInterceptConfig: cacheInterceptConfig.value,
|
|
743
|
+
interceptNetworkList: interceptNetworkList.value,
|
|
725
744
|
});
|
|
726
745
|
}
|
|
727
746
|
|
|
@@ -1119,6 +1138,20 @@ function onChangeTheme(t: string) {
|
|
|
1119
1138
|
});
|
|
1120
1139
|
}
|
|
1121
1140
|
|
|
1141
|
+
function onChangeCacheInterceptConfig(value: boolean) {
|
|
1142
|
+
setDevToolInfo({
|
|
1143
|
+
cacheInterceptConfig: value,
|
|
1144
|
+
interceptNetworkList: value ? interceptNetworkList.value : [],
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
basicSendMessage({
|
|
1148
|
+
type: DEV_CHANGE_CACHE_INTERCEPT_CONFIG,
|
|
1149
|
+
data: {
|
|
1150
|
+
cacheInterceptConfig: value,
|
|
1151
|
+
},
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1122
1155
|
function onChangeVuex(value: Record<string, any>) {
|
|
1123
1156
|
basicSendMessage({
|
|
1124
1157
|
type: DEV_VUEX_CHANGE,
|
|
@@ -1171,6 +1204,108 @@ function onOpenCode(value?: string) {
|
|
|
1171
1204
|
openCode.value = true;
|
|
1172
1205
|
}
|
|
1173
1206
|
}
|
|
1207
|
+
|
|
1208
|
+
function onOpenNetworkDetail(ni?: DevTool.NetworkItem) {
|
|
1209
|
+
Object.assign(network, emptyNetwork);
|
|
1210
|
+
Object.assign(network, ni);
|
|
1211
|
+
showNetworkDetail.value = true;
|
|
1212
|
+
}
|
|
1213
|
+
function onCloseNetworkDetail() {
|
|
1214
|
+
showNetworkDetail.value = false;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
function onOpenNetworkSend(ni?: DevTool.NetworkItem) {
|
|
1218
|
+
Object.assign(network, emptyNetwork);
|
|
1219
|
+
Object.assign(network, ni);
|
|
1220
|
+
showNetworkSend.value = true;
|
|
1221
|
+
}
|
|
1222
|
+
function onCloseNetworkSend() {
|
|
1223
|
+
showNetworkSend.value = false;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
function onOpenNetworkIntercept() {
|
|
1227
|
+
showNetworkIntercept.value = true;
|
|
1228
|
+
}
|
|
1229
|
+
function onCloseNetworkIntercept() {
|
|
1230
|
+
showNetworkIntercept.value = false;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
function onOpenInterceptConfig(ni?: DevTool.NetworkItem) {
|
|
1234
|
+
Object.assign(network, emptyNetwork);
|
|
1235
|
+
|
|
1236
|
+
ni && Object.assign(network, ni);
|
|
1237
|
+
|
|
1238
|
+
showInterceptConfig.value = true;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
function onCloseInterceptConfig() {
|
|
1242
|
+
showInterceptConfig.value = false;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
function onRemoveInterceptConfig(ni: DevTool.NetworkItem) {
|
|
1246
|
+
basicSendMessage({
|
|
1247
|
+
type: DEV_INTERCEPT_NETWORK_REMOVE,
|
|
1248
|
+
data: ni,
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
function onConfirmInterceptConfig(ni: DevTool.NetworkItem) {
|
|
1253
|
+
const index = interceptNetworkList.value.findIndex((item) => {
|
|
1254
|
+
const key = `${item.method?.toUpperCase()}|${item.url?.split('?')[0]}`;
|
|
1255
|
+
const niKey = `${ni.method?.toUpperCase()}|${ni.url?.split('?')[0]}`;
|
|
1256
|
+
return key === niKey;
|
|
1257
|
+
});
|
|
1258
|
+
const list = [...interceptNetworkList.value];
|
|
1259
|
+
|
|
1260
|
+
if (index > -1) {
|
|
1261
|
+
list[index] = ni;
|
|
1262
|
+
} else {
|
|
1263
|
+
list.unshift(ni);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
setDevToolInfo({
|
|
1267
|
+
cacheInterceptConfig: cacheInterceptConfig.value,
|
|
1268
|
+
interceptNetworkList: cacheInterceptConfig.value ? list : [],
|
|
1269
|
+
});
|
|
1270
|
+
basicSendMessage({
|
|
1271
|
+
type: DEV_INTERCEPT_NETWORK_UPDATE,
|
|
1272
|
+
data: [ni],
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
function onOpenUploadDetail(up?: DevTool.UploadItem) {
|
|
1277
|
+
Object.assign(upload, up);
|
|
1278
|
+
showUploadDetail.value = true;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
function onCloseUploadDetail() {
|
|
1282
|
+
showUploadDetail.value = false;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
function onOpenWebSocketDetail(ws?: DevTool.WS) {
|
|
1286
|
+
Object.assign(webSocket, ws);
|
|
1287
|
+
|
|
1288
|
+
nextTick(() => {
|
|
1289
|
+
if (currentWebSocket.value) {
|
|
1290
|
+
showWebSocketDetail.value = true;
|
|
1291
|
+
} else {
|
|
1292
|
+
//
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
function onCloseWebSocketDetail() {
|
|
1298
|
+
showWebSocketDetail.value = false;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function onClearWebSocketMessage(ws: DevTool.WS) {
|
|
1302
|
+
console.log('ws: ', ws);
|
|
1303
|
+
|
|
1304
|
+
basicSendMessage({
|
|
1305
|
+
type: DEV_WEBSOCKET_CLEAR_MESSAGE,
|
|
1306
|
+
data: ws,
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1174
1309
|
</script>
|
|
1175
1310
|
|
|
1176
1311
|
<style scoped>
|
|
@@ -1224,7 +1359,6 @@ function onOpenCode(value?: string) {
|
|
|
1224
1359
|
--dev-tool-info-color: #9c9c9c;
|
|
1225
1360
|
--dev-tool-log-color: #f9f9f9;
|
|
1226
1361
|
--dev-tool-nil-color: #020201;
|
|
1227
|
-
--dev-tool-string-color: #888888;
|
|
1228
1362
|
--dev-tool-number-color: #1d8ce0;
|
|
1229
1363
|
--dev-tool-boolean-color: #1d8ce0;
|
|
1230
1364
|
--dev-tool-symbol-color: bisque;
|