vite-uni-dev-tool 0.0.16 → 0.0.17

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 (37) hide show
  1. package/README.md +6 -0
  2. package/dist/devIntercept/index.d.ts.map +1 -1
  3. package/dist/devIntercept/index.js +139 -137
  4. package/dist/devStore/index.js +1 -1
  5. package/dist/type.d.ts +5 -1
  6. package/dist/type.d.ts.map +1 -1
  7. package/dist/v2/{CloseButton → CircularButton}/index.vue +5 -2
  8. package/dist/v2/NetworkList/NetworkDetail.vue +3 -3
  9. package/dist/v2/NetworkList/NetworkItem.vue +5 -3
  10. package/dist/v2/SettingList/index.vue +1 -1
  11. package/dist/v2/SourceCode/index.vue +3 -3
  12. package/dist/v2/StorageList/index.vue +7 -3
  13. package/dist/v2/Tabs/index.vue +3 -3
  14. package/dist/v2/UploadList/UploadDetail.vue +3 -3
  15. package/dist/v2/WebSocket/WebSocketList.vue +3 -3
  16. package/dist/v3/{CloseButton → CircularButton}/index.vue +4 -2
  17. package/dist/v3/ConsoleList/ConsoleItem.vue +44 -96
  18. package/dist/v3/ConsoleList/index.vue +2 -0
  19. package/dist/v3/DevTool/index.vue +4 -4
  20. package/dist/v3/DevToolWindow/index.vue +162 -14
  21. package/dist/v3/FilterSelect/index.vue +165 -0
  22. package/dist/v3/NetworkList/NetworkDetail.vue +11 -8
  23. package/dist/v3/NetworkList/NetworkItem.vue +56 -26
  24. package/dist/v3/NetworkList/NetworkSend.vue +819 -0
  25. package/dist/v3/NetworkList/const.d.ts +5 -0
  26. package/dist/v3/NetworkList/const.d.ts.map +1 -0
  27. package/dist/v3/NetworkList/const.ts +4 -0
  28. package/dist/v3/NetworkList/index.vue +104 -21
  29. package/dist/v3/SettingList/index.vue +1 -1
  30. package/dist/v3/SourceCode/index.vue +22 -8
  31. package/dist/v3/StorageList/index.vue +7 -6
  32. package/dist/v3/Tabs/index.vue +2 -2
  33. package/dist/v3/UniEvent/UniEventItem.vue +6 -54
  34. package/dist/v3/UniEvent/index.vue +2 -0
  35. package/dist/v3/UploadList/UploadDetail.vue +2 -2
  36. package/dist/v3/WebSocket/WebSocketList.vue +2 -2
  37. package/package.json +1 -1
@@ -39,6 +39,7 @@
39
39
  @choose="onConsoleChoose"
40
40
  @search="onSearchConsole"
41
41
  @run="onRunJS"
42
+ @openCode="onOpenCode"
42
43
  />
43
44
  </swiper-item>
44
45
  <swiper-item>
@@ -47,12 +48,17 @@
47
48
  <swiper-item>
48
49
  <NetworkList
49
50
  v-if="swiperShow(2)"
50
- :currentNetworkType="currentNetworkType"
51
- :networkList="networkList"
52
- :zIndex="zIndex + 1"
53
51
  v-model="searchNetwork"
52
+ :mode="mode"
53
+ :zIndex="zIndex + 1"
54
+ :networkList="networkList"
55
+ :useDevSource="useDevSource"
56
+ :currentNetworkType="currentNetworkType"
57
+ :currentNetworkSort="currentNetworkSort"
54
58
  @choose="onNetworkChoose"
55
59
  @search="onSearchNetwork"
60
+ @sort="onSortNetwork"
61
+ @openCode="onOpenCode"
56
62
  />
57
63
  </swiper-item>
58
64
  <swiper-item>
@@ -90,13 +96,14 @@
90
96
  <swiper-item>
91
97
  <UniEvent
92
98
  v-if="swiperShow(6)"
99
+ :mode="mode"
93
100
  :eventList="eventList"
94
101
  :eventCount="eventCount"
95
- :mode="mode"
102
+ :zIndex="zIndex + 1"
96
103
  :useDevSource="useDevSource"
97
104
  :sourceFileServers="sourceFileServers"
98
- :zIndex="zIndex + 1"
99
105
  @clear="onUniEventClear"
106
+ @openCode="onOpenCode"
100
107
  />
101
108
  </swiper-item>
102
109
  <swiper-item>
@@ -160,6 +167,16 @@
160
167
  />
161
168
  </swiper-item>
162
169
  </swiper>
170
+
171
+ <!-- 源码查看 -->
172
+ <SourceCode
173
+ v-if="openCode"
174
+ :url="stack"
175
+ :sourceFileServers="sourceFileServers"
176
+ :mode="mode"
177
+ :zIndex="zIndex"
178
+ @close="onCloseCode"
179
+ />
163
180
  </view>
164
181
  </template>
165
182
 
@@ -183,6 +200,8 @@ import UploadList from '../UploadList/index.vue';
183
200
  import UniEvent from '../UniEvent/index.vue';
184
201
  import AppInfo from '../AppInfo/index.vue';
185
202
  import CaptureScreen from '../CaptureScreen/index.vue';
203
+ import SourceCode from '../SourceCode/index.vue';
204
+
186
205
  import {
187
206
  DEV_BUTTON_SHOW_OR_HIDE,
188
207
  DEV_CONSOLE_CLEAR,
@@ -208,7 +227,7 @@ import {
208
227
  DEV_RUN_JS,
209
228
  DEV_CAPTURE_SCREEN_CLEAR,
210
229
  } from '../../const';
211
- import { debounce, hightLight } from '../../utils/index';
230
+ import { debounce, hightLight, isAndroid, isMockWX } from '../../utils/index';
212
231
  import type { DevTool } from '../../type';
213
232
  import { eventBus } from '../../core';
214
233
  import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
@@ -360,6 +379,7 @@ const activeTab = ref(0);
360
379
  const tabScrollLeft = ref(0);
361
380
  const currentConsoleType = ref('all');
362
381
  const currentNetworkType = ref('all');
382
+ const currentNetworkSort = ref(1);
363
383
  const currentUploadType = ref('all');
364
384
  const currentWebSocketType = ref('all');
365
385
 
@@ -370,6 +390,8 @@ const searchWs = ref('');
370
390
  const searchRoute = ref('');
371
391
  const searchStorage = ref('');
372
392
  const theme = ref('light');
393
+ const openCode = ref(false);
394
+ const stack = ref('');
373
395
 
374
396
  const props = withDefaults(
375
397
  defineProps<{
@@ -398,6 +420,51 @@ function swiperShow(index: number) {
398
420
  return show;
399
421
  }
400
422
 
423
+ const calcLineStartAndEnd = (
424
+ list: DevTool.NetworkItem[],
425
+ ): {
426
+ startTime: number;
427
+ endTime: number;
428
+ } => {
429
+ const startTime = Math.min(...list.map((item) => item.startTime));
430
+ const endTime = Math.max(...list.map((item) => item?.endTime ?? Date.now()));
431
+
432
+ return { startTime, endTime };
433
+ };
434
+
435
+ /**
436
+ * 计算 时间轴
437
+ * @param list
438
+ * @param startTime
439
+ * @param endTime
440
+ */
441
+ const calcNetworkTimeline = (
442
+ list: DevTool.NetworkItem[],
443
+ startTime: number,
444
+ endTime: number,
445
+ ): DevTool.NetworkItem[] => {
446
+ const total = endTime - startTime;
447
+
448
+ return (
449
+ list?.map((item) => {
450
+ const width =
451
+ (
452
+ (((item.endTime ?? Date.now()) - item.startTime) / total) *
453
+ 100
454
+ ).toFixed(2) + '%';
455
+
456
+ const left =
457
+ (((item.startTime - startTime) / total) * 100).toFixed(2) + '%';
458
+
459
+ return {
460
+ ...item,
461
+ width,
462
+ left,
463
+ };
464
+ }) ?? []
465
+ );
466
+ };
467
+
401
468
  const listenPostMessage = (data: DevTool.WindowData) => {
402
469
  if (!props.open) return;
403
470
  if (!isActive) return;
@@ -444,7 +511,11 @@ const listenPostMessage = (data: DevTool.WindowData) => {
444
511
  }
445
512
 
446
513
  if (data.networkList) {
447
- networkList.value = [...(data.networkList ?? [])]
514
+ const { startTime, endTime } = calcLineStartAndEnd(data.networkList);
515
+
516
+ const list = calcNetworkTimeline(data.networkList, startTime, endTime);
517
+
518
+ networkList.value = list
448
519
  .filter((item) => {
449
520
  if (currentNetworkType.value === 'all') return item;
450
521
  if (currentNetworkType.value !== 'clear') {
@@ -458,6 +529,13 @@ const listenPostMessage = (data: DevTool.WindowData) => {
458
529
  ...item,
459
530
  url: hightLight(item.url, searchNetwork.value),
460
531
  };
532
+ })
533
+ ?.sort((a, b) => {
534
+ if (currentNetworkSort.value === 1) {
535
+ return b.startTime - a.startTime;
536
+ } else {
537
+ return a.startTime - b.startTime;
538
+ }
461
539
  });
462
540
 
463
541
  backup.networkList = [...data.networkList];
@@ -528,6 +606,7 @@ const listenPostMessage = (data: DevTool.WindowData) => {
528
606
  });
529
607
  backup.routeList = [...data.routeList];
530
608
  }
609
+
531
610
  if (data.eventList) {
532
611
  eventList.value = [...data.eventList];
533
612
  }
@@ -604,13 +683,14 @@ onUnload(() => {
604
683
  onShow(() => {
605
684
  isActive = true;
606
685
  });
607
- onHide(() => {
608
- isActive = false;
609
686
 
610
- setDevToolInfo({
611
- devToolWindowVisible: false,
612
- });
613
- });
687
+ // onHide(() => {
688
+ // isActive = false;
689
+
690
+ // setDevToolInfo({
691
+ // devToolWindowVisible: false,
692
+ // });
693
+ // });
614
694
 
615
695
  /** 发送消息给 uniapp */
616
696
  function basicSendMessage(message: {
@@ -760,6 +840,23 @@ function onSearchNetwork(value: string) {
760
840
  });
761
841
  }
762
842
 
843
+ /**
844
+ * 排序
845
+ * @param sort -1 降序 1 升序
846
+ */
847
+ function onSortNetwork(sort: -1 | 1) {
848
+ currentNetworkSort.value = sort;
849
+
850
+ const list = networkList.value.sort((a, b) => {
851
+ if (sort === 1) {
852
+ return b.startTime - a.startTime;
853
+ } else {
854
+ return a.startTime - b.startTime;
855
+ }
856
+ });
857
+ networkList.value = [...list];
858
+ }
859
+
763
860
  function onUploadChoose(type: string) {
764
861
  if (type === 'clear') {
765
862
  uploadList.value = [];
@@ -1020,12 +1117,51 @@ function onChangePinia(value: Record<string, any>) {
1020
1117
  data: value,
1021
1118
  });
1022
1119
  }
1120
+
1121
+ function onCloseCode() {
1122
+ openCode.value = false;
1123
+ stack.value = '';
1124
+ }
1125
+ function onOpenCode(value: string) {
1126
+ if (!value) return;
1127
+
1128
+ stack.value = value;
1129
+
1130
+ const isWXLink = isMockWX(value ?? '') || props.mode !== 'development';
1131
+ const isUseDevSource = !isWXLink && props.useDevSource;
1132
+
1133
+ if (isWXLink) {
1134
+ uni.showToast({
1135
+ icon: 'none',
1136
+ title: '[DevTool] 请在小程序真机调试模式下查看源码',
1137
+ });
1138
+ return;
1139
+ }
1140
+
1141
+ if (!isUseDevSource) {
1142
+ return;
1143
+ }
1144
+
1145
+ if (isAndroid()) {
1146
+ if (props.sourceFileServers && props.sourceFileServers?.length > 0) {
1147
+ openCode.value = true;
1148
+ } else {
1149
+ uni.showToast({
1150
+ icon: 'none',
1151
+ title: '[DevTool] sourceFileServers 配置异常',
1152
+ });
1153
+ uni?.__dev__console?.log('[DevTool] sourceFileServers 配置异常');
1154
+ }
1155
+ } else {
1156
+ openCode.value = true;
1157
+ }
1158
+ }
1023
1159
  </script>
1024
1160
 
1025
1161
  <style scoped>
1026
1162
  .dev-tool-window {
1027
1163
  --dev-tool-main-color: #9254de;
1028
- --dev-tool-normal-bg-color: #f9f9f9;
1164
+
1029
1165
  --dev-tool-warn-color: #ffa940;
1030
1166
  --dev-tool-warn-bg-color: #fff7e6;
1031
1167
  --dev-tool-error-color: #ff4d4f;
@@ -1036,6 +1172,10 @@ function onChangePinia(value: Record<string, any>) {
1036
1172
  --dev-tool-base-font-size: 12px;
1037
1173
  --dev-tool-tag-font-size: 10px;
1038
1174
  --dev-tool-tips-font-size: 10px;
1175
+
1176
+ --dev-tool-text-color-placeholder: #909090;
1177
+
1178
+ --dev-tool-active-bg-color: rgba(0, 0, 0, 0.05);
1039
1179
  -webkit-tap-highlight-color: transparent;
1040
1180
 
1041
1181
  position: fixed;
@@ -1061,8 +1201,10 @@ function onChangePinia(value: Record<string, any>) {
1061
1201
  .dev-tool-window-light {
1062
1202
  --dev-tool-bg-color: rgba(255, 255, 255, 0.8);
1063
1203
  --dev-tool-bg2-color: rgba(255, 255, 255, 0.95);
1204
+ --dev-tool-bg3-color: rgba(255, 255, 255, 0.999);
1064
1205
 
1065
1206
  --dev-tool-text-color: #000;
1207
+
1066
1208
  --dev-tool-border-color: #f0f0f0;
1067
1209
  --dev-tool-info-color: #9c9c9c;
1068
1210
  --dev-tool-log-color: #f9f9f9;
@@ -1071,15 +1213,21 @@ function onChangePinia(value: Record<string, any>) {
1071
1213
  --dev-tool-number-color: #1d8ce0;
1072
1214
  --dev-tool-boolean-color: #1d8ce0;
1073
1215
  --dev-tool-symbol-color: bisque;
1216
+ --dev-tool-active-bg-color: #f0f0f0;
1217
+ --dev-tool-time-line-color: #9254de;
1074
1218
  }
1075
1219
  .dev-tool-window-dart {
1076
1220
  --dev-tool-bg-color: rgba(0, 0, 0, 0.8);
1077
1221
  --dev-tool-bg2-color: rgba(43, 43, 43, 0.8);
1222
+ --dev-tool-bg3-color: rgba(43, 43, 43, 0.999);
1078
1223
 
1079
1224
  --dev-tool-text-color: #fff;
1080
1225
  --dev-tool-border-color: #3d3d3d;
1081
1226
 
1082
1227
  --dev-tool-log-color: #f9f9f9;
1228
+ --dev-tool-active-bg-color: #3d3d3d;
1229
+
1230
+ --dev-tool-time-line-color: #f9f9f9;
1083
1231
  }
1084
1232
 
1085
1233
  .dev-tool-window-bg {
@@ -0,0 +1,165 @@
1
+ <template>
2
+ <view class="filter-select-wrapper">
3
+ <view
4
+ v-if="readonly"
5
+ :class="`filter-select ${!modelValue ? 'filter-select-placeholder' : ''}`"
6
+ @click="onOpenList"
7
+ >
8
+ {{ label ?? (placeholder || '请选择') }}
9
+ </view>
10
+ <input
11
+ v-else
12
+ :class="`filter-select`"
13
+ :value="label"
14
+ :placeholder="placeholder || '请选择'"
15
+ @confirm="debounceInput"
16
+ @focus="onOpenList"
17
+ />
18
+ <view class="filter-select-clear" v-if="allowClear" @click="onClear">
19
+ ×
20
+ </view>
21
+
22
+ <view class="filter-select-list" v-if="isActive">
23
+ <view
24
+ v-for="item in options"
25
+ :key="item.value"
26
+ :class="`filter-select-item ${
27
+ item.value === modelValue ? 'filter-select-item-active' : ''
28
+ }`"
29
+ @click="onSelect(item)"
30
+ >
31
+ {{ item.label }}
32
+ </view>
33
+ </view>
34
+
35
+ <view
36
+ class="filter-select-mask"
37
+ v-if="isActive"
38
+ @click="isActive = false"
39
+ ></view>
40
+ </view>
41
+ </template>
42
+ <script lang="ts" setup>
43
+ import { debounce } from '../../utils';
44
+ import { ref, computed } from 'vue';
45
+ const props = defineProps<{
46
+ placeholder?: string;
47
+ modelValue?: string;
48
+ readonly?: boolean;
49
+ allowClear?: boolean;
50
+ options?: { label: string; value: any }[];
51
+ }>();
52
+ const emit = defineEmits<{
53
+ (e: 'update:modelValue', value: string): void;
54
+ (e: 'search', value: string): void;
55
+ (e: 'openSearch', value: boolean): void;
56
+ (e: 'change', value: { label: string; value: any }): void;
57
+ }>();
58
+
59
+ const isActive = ref(false);
60
+
61
+ const label = computed(() => {
62
+ return (
63
+ props.options?.find((item) => item.value === props.modelValue)?.label ??
64
+ props.modelValue
65
+ );
66
+ });
67
+
68
+ function onInput(e: any) {
69
+ const value = e.detail.value;
70
+ emit('update:modelValue', value);
71
+ emit('search', value);
72
+ }
73
+
74
+ function onClear() {
75
+ emit('update:modelValue', '');
76
+ emit('search', '');
77
+ }
78
+
79
+ const debounceInput = debounce(onInput, 500);
80
+
81
+ function onOpenList() {
82
+ isActive.value = true;
83
+ }
84
+
85
+ function onSelect(item: { label: string; value: any }) {
86
+ emit('change', item);
87
+ isActive.value = false;
88
+ }
89
+ </script>
90
+ <style scoped>
91
+ .filter-select-wrapper {
92
+ position: relative;
93
+ flex: 1;
94
+ display: flex;
95
+ align-items: center;
96
+ padding: 0 8px;
97
+ width: 100%;
98
+ height: 24px;
99
+
100
+ border-radius: 4px;
101
+ border: 1px solid var(--dev-tool-border-color);
102
+
103
+ background-color: var(--dev-tool-bg-color);
104
+ transition: background-color 0.3s;
105
+ box-sizing: border-box;
106
+ }
107
+
108
+ .filter-select {
109
+ flex: 1;
110
+ box-shadow: none;
111
+ box-sizing: border-box;
112
+ border-radius: 5;
113
+ font-family: inherit;
114
+ color: var(--dev-tool-text-color);
115
+ font-weight: 400;
116
+ font: unset;
117
+ height: 24px;
118
+ line-height: 24px;
119
+ transition: color 0.3s;
120
+ }
121
+
122
+ .filter-select-placeholder {
123
+ color: var(--dev-tool-text-color-placeholder);
124
+ }
125
+
126
+ .filter-select-clear {
127
+ padding-left: 8px;
128
+ }
129
+
130
+ .filter-select-icon {
131
+ width: 24px;
132
+ height: 24px;
133
+ }
134
+
135
+ .filter-select-list {
136
+ z-index: 9999;
137
+ position: absolute;
138
+ top: 24px;
139
+ left: 0;
140
+ max-height: 300px;
141
+ width: 100%;
142
+ overflow: auto;
143
+ background-color: var(--dev-tool-bg2-color);
144
+ }
145
+
146
+ .filter-select-item {
147
+ width: 100%;
148
+ height: 24px;
149
+ line-height: 24px;
150
+ padding: 0 8px;
151
+ }
152
+
153
+ .filter-select-item-active {
154
+ background-color: var(--dev-tool-active-bg-color);
155
+ }
156
+
157
+ .filter-select-mask {
158
+ position: fixed;
159
+ z-index: 9005;
160
+ top: 0;
161
+ left: 0;
162
+ width: 100vw;
163
+ height: 100vh;
164
+ }
165
+ </style>
@@ -10,11 +10,11 @@
10
10
  >
11
11
  {{ item.label }}
12
12
  </Tag>
13
- <CloseButton style="margin-left: auto" @click="onClose" />
13
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
14
14
  </view>
15
15
 
16
16
  <view class="network-detail-header" v-if="currentSelect === 'header'">
17
- <view class="network-detail-title">常规</view>
17
+ <DevToolTitle>常规</DevToolTitle>
18
18
  <view class="net-detail-item">
19
19
  <view>请求url:</view>
20
20
  <view>{{ network.url }}</view>
@@ -27,7 +27,8 @@
27
27
  <view>状态代码:</view>
28
28
  {{ network.status }}
29
29
  </view>
30
- <view class="network-detail-title">请求头</view>
30
+
31
+ <DevToolTitle>请求头</DevToolTitle>
31
32
  <view
32
33
  class="net-detail-item"
33
34
  v-for="item in network.headers.requestHeader"
@@ -36,7 +37,8 @@
36
37
  <view>{{ item.key }}:</view>
37
38
  {{ item.value }}
38
39
  </view>
39
- <view class="network-detail-title">响应头</view>
40
+
41
+ <DevToolTitle>响应头</DevToolTitle>
40
42
  <view
41
43
  class="net-detail-item"
42
44
  v-for="item in network.headers.responseHeader"
@@ -79,7 +81,8 @@ import { ref, computed } from 'vue';
79
81
  import JsonPretty from '../JsonPretty/index.vue';
80
82
  import Tag from '../Tag/index.vue';
81
83
  import Empty from '../Empty/index.vue';
82
- import CloseButton from '../CloseButton/index.vue';
84
+ import CircularButton from '../CircularButton/index.vue';
85
+ import DevToolTitle from '../DevToolTitle/index.vue';
83
86
  import type { DevTool } from '../../type';
84
87
  const props = defineProps<{ network: DevTool.NetworkItem; zIndex?: number }>();
85
88
  const emit = defineEmits<{ (e: 'close'): void }>();
@@ -150,13 +153,13 @@ function onClose() {
150
153
  .network-detail {
151
154
  position: fixed;
152
155
  width: 100vw;
153
- height: 100vh;
154
- z-index: 1001;
156
+ height: 100%;
157
+ /* z-index: 1001; */
155
158
  top: 0;
156
159
  left: 0;
157
160
  padding: 0 16px;
158
161
 
159
- background-color: var(--dev-tool-bg-color);
162
+ background-color: var(--dev-tool-bg3-color);
160
163
  box-sizing: border-box;
161
164
  }
162
165
  .network-detail .network-detail-control {
@@ -1,16 +1,13 @@
1
1
  <template>
2
- <view class="network-item">
2
+ <view class="network-item" @click="emit('openDetail')">
3
3
  <view class="network-url-row">
4
4
  <Tag mode="info">{{ network.method }}</Tag>
5
5
 
6
6
  <view class="network-url" v-html="lastUrl"> </view>
7
7
 
8
- <Tag
9
- mode="main"
10
- class="network-detail-icon"
11
- @click="showDetail = !showDetail"
12
- >详情</Tag
13
- >
8
+ <Tag mode="main" class="network-detail-icon" @click.stop="emit('resend')">
9
+ 重发
10
+ </Tag>
14
11
  </view>
15
12
  <view class="network-info">
16
13
  <view>
@@ -29,52 +26,69 @@
29
26
  <!-- <view>{{ network.status }}</view> -->
30
27
  <view>{{ network.time }}</view>
31
28
  <view>{{ network.size }}</view>
32
- <view
33
- >开始:
29
+ <view>
30
+ {{ sortMap?.[props.currentNetworkSort] ?? '一' }}
31
+ 开始:
34
32
  {{
35
33
  network.startTime
36
- ? formatDate(network.startTime, 'HH:mm:ss')
34
+ ? formatDate(network.startTime, 'HH:mm:ss:SS')
37
35
  : '--:--:--'
38
36
  }}</view
39
37
  >
40
38
  <view>
41
39
  结束:
42
40
  {{
43
- network.endTime ? formatDate(network.endTime, 'HH:mm:ss') : '--:--:--'
41
+ network.endTime
42
+ ? formatDate(network.endTime, 'HH:mm:ss:SS')
43
+ : '--:--:--:---'
44
44
  }}
45
45
  </view>
46
46
  </view>
47
+ <view
48
+ class="network-time-line"
49
+ :style="`width: ${network.width}; left: ${network.left};`"
50
+ ></view>
51
+ <view
52
+ :class="`network-stock ${isUseDevSource ? 'network-stock-link' : ''}`"
53
+ @click.stop="emit('openCode', network.stack)"
54
+ >
55
+ {{ network?.stack }}
56
+ </view>
47
57
  </view>
48
- <!-- <Transition name="slide-fade"> -->
49
- <NetworkDetail
50
- v-if="showDetail"
51
- :network="network"
52
- :zIndex="zIndex"
53
- @close="onClose"
54
- />
55
- <!-- </Transition> -->
56
58
  </template>
57
59
 
58
60
  <script lang="ts" setup>
59
- import { computed, ref } from 'vue';
61
+ import { computed } from 'vue';
62
+ import { sortMap } from './const';
60
63
  import Tag from '../Tag/index.vue';
61
- import NetworkDetail from './NetworkDetail.vue';
62
- import { formatDate } from '../../utils';
64
+ import { formatDate, isMockWX } from '../../utils';
63
65
  import type { DevTool } from '../../type';
64
66
  const props = defineProps<{
65
67
  network: DevTool.NetworkItem;
68
+ currentNetworkSort: -1 | 1;
66
69
  zIndex?: number;
70
+ mode?: string;
71
+ useDevSource?: boolean;
72
+ }>();
73
+
74
+ const emit = defineEmits<{
75
+ (e: 'openDetail'): void;
76
+ (e: 'resend'): void;
77
+ (e: 'openCode', value?: string): void;
67
78
  }>();
68
- const showDetail = ref(false);
69
79
 
70
80
  const lastUrl = computed(() => {
71
81
  const start = props.network.url.lastIndexOf('/');
72
82
  return props.network.url.slice(start + 1);
73
83
  });
74
84
 
75
- function onClose() {
76
- showDetail.value = false;
77
- }
85
+ const isUseDevSource = computed(() => {
86
+ return (
87
+ !isMockWX(props?.network?.stack ?? '') &&
88
+ props.mode === 'development' &&
89
+ props.useDevSource
90
+ );
91
+ });
78
92
  </script>
79
93
  <style scoped>
80
94
  .network-item {
@@ -117,4 +131,20 @@ function onClose() {
117
131
  transform: translateY(20px);
118
132
  opacity: 0;
119
133
  }
134
+
135
+ .network-time-line {
136
+ position: relative;
137
+ margin-top: 10px;
138
+ height: 2px;
139
+ min-width: 6px;
140
+ background-color: var(--dev-tool-time-line-color);
141
+ }
142
+
143
+ .network-stock {
144
+ text-align: right;
145
+ word-wrap: break-all;
146
+ }
147
+ .network-stock-link {
148
+ text-decoration: underline;
149
+ }
120
150
  </style>