vite-uni-dev-tool 0.0.20 → 0.0.22

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 (40) hide show
  1. package/README.md +14 -3
  2. package/dist/const.d.ts +12 -0
  3. package/dist/const.d.ts.map +1 -1
  4. package/dist/const.js +23 -20
  5. package/dist/core.d.ts +3 -3
  6. package/dist/core.d.ts.map +1 -1
  7. package/dist/core.js +89 -49
  8. package/dist/devEvent/index.d.ts +34 -0
  9. package/dist/devEvent/index.d.ts.map +1 -1
  10. package/dist/devEvent/index.js +71 -27
  11. package/dist/devIntercept/index.d.ts.map +1 -1
  12. package/dist/devIntercept/index.js +171 -145
  13. package/dist/devStore/index.d.ts +9 -0
  14. package/dist/devStore/index.d.ts.map +1 -1
  15. package/dist/devStore/index.js +54 -20
  16. package/dist/plugins/uniDevTool/uniDevTool.d.ts +1 -1
  17. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  18. package/dist/type.d.ts +18 -1
  19. package/dist/type.d.ts.map +1 -1
  20. package/dist/v2/DevTool/index.vue +8 -8
  21. package/dist/v3/DevTool/index.vue +13 -12
  22. package/dist/v3/DevToolWindow/const.d.ts +30 -0
  23. package/dist/v3/DevToolWindow/const.d.ts.map +1 -0
  24. package/dist/v3/DevToolWindow/const.ts +123 -0
  25. package/dist/v3/DevToolWindow/index.vue +186 -107
  26. package/dist/v3/NetworkList/InterceptConfig.vue +835 -0
  27. package/dist/v3/NetworkList/InterceptItem.vue +132 -0
  28. package/dist/v3/NetworkList/NetworkDetail.vue +86 -31
  29. package/dist/v3/NetworkList/NetworkIntercept.vue +85 -0
  30. package/dist/v3/NetworkList/NetworkItem.vue +18 -18
  31. package/dist/v3/NetworkList/NetworkSend.vue +61 -45
  32. package/dist/v3/NetworkList/index.vue +11 -67
  33. package/dist/v3/SettingList/index.vue +23 -2
  34. package/dist/v3/SourceCode/Line.vue +101 -0
  35. package/dist/v3/SourceCode/index.vue +35 -62
  36. package/dist/v3/SourceCode/parseCode.d.ts +27 -0
  37. package/dist/v3/SourceCode/parseCode.d.ts.map +1 -0
  38. package/dist/v3/SourceCode/parseCode.ts +643 -0
  39. package/dist/v3/Tag/index.vue +1 -0
  40. package/package.json +1 -1
@@ -1,5 +1,9 @@
1
1
  <template>
2
2
  <view class="network-send" :style="{ zIndex: zIndex }">
3
+ <view class="network-send-control">
4
+ <DevToolTitle>发起请求</DevToolTitle>
5
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
6
+ </view>
3
7
  <view class="network-send-form">
4
8
  <view class="network-send-control">
5
9
  <DevToolTitle>超时时间</DevToolTitle>
@@ -11,7 +15,6 @@
11
15
  />
12
16
  <view class="network-send-control">
13
17
  <DevToolTitle>请求方式</DevToolTitle>
14
- <CircularButton style="margin-left: auto" text="×" @click="onClose" />
15
18
  </view>
16
19
  <radio-group class="radio-group" @change="onChangeRequestMethod">
17
20
  <label
@@ -22,6 +25,7 @@
22
25
  <radio
23
26
  size
24
27
  style="transform: scale(0.8)"
28
+ color="#9254de"
25
29
  :value="item.value"
26
30
  :checked="item.value === state.method"
27
31
  />
@@ -48,7 +52,7 @@
48
52
  v-for="(item, index) in headerList"
49
53
  :key="item.id"
50
54
  >
51
- <checkbox :checked="item.checked" />
55
+ <checkbox color="#9254de" :checked="item.checked" />
52
56
  <input
53
57
  class="network-input"
54
58
  placeholder="请输入请求头名称"
@@ -103,7 +107,11 @@
103
107
  v-for="(item, index) in queryList"
104
108
  :key="item.id"
105
109
  >
106
- <checkbox :checked="item.checked" :value="item.id" />
110
+ <checkbox
111
+ color="#9254de"
112
+ :checked="item.checked"
113
+ :value="item.id"
114
+ />
107
115
  <input
108
116
  class="network-input"
109
117
  placeholder="请输入参数名称"
@@ -142,20 +150,17 @@
142
150
  @input="onChangeState($event, 'bodyText')"
143
151
  />
144
152
  </template>
145
-
146
- <view class="network-send-buttons">
147
- <button size="mini" :disabled="!isFinished" @click="onDetail">
148
- 详情
149
- </button>
150
- <button size="mini" @click="onReset">重置</button>
151
- <button size="mini" @click="onSend">发送</button>
152
- </view>
153
-
154
- <NetworkDetail
155
- v-show="showDetail"
156
- :network="network"
157
- @close="onCloseDetail"
158
- />
153
+ </view>
154
+ <view class="network-send-buttons">
155
+ <button
156
+ size="mini"
157
+ :disabled="!isFinished"
158
+ @click="emit('openDetail', network)"
159
+ >
160
+ 详情
161
+ </button>
162
+ <button size="mini" @click="onReset">重置</button>
163
+ <button size="mini" @click="onSend">发送</button>
159
164
  </view>
160
165
  </view>
161
166
  </template>
@@ -163,12 +168,18 @@
163
168
  import { ref, reactive, onMounted } from 'vue';
164
169
  import CircularButton from '../CircularButton/index.vue';
165
170
  import DevToolTitle from '../DevToolTitle/index.vue';
166
- import NetworkDetail from './NetworkDetail.vue';
167
171
  import type { DevTool } from '../../type';
168
172
 
169
- const props = defineProps<{ network: DevTool.NetworkItem; zIndex?: number }>();
173
+ const props = defineProps<{
174
+ network: DevTool.NetworkItem;
175
+ zIndex?: number;
176
+ interceptNetworkList?: DevTool.NetworkItem[];
177
+ }>();
170
178
 
171
- const emit = defineEmits<{ (e: 'close'): void }>();
179
+ const emit = defineEmits<{
180
+ (e: 'close'): void;
181
+ (e: 'openDetail', v: DevTool.NetworkItem): void;
182
+ }>();
172
183
 
173
184
  const requestMethods = [
174
185
  { name: 'GET', value: 'GET' },
@@ -241,8 +252,6 @@ const queryList = reactive<PB[]>([
241
252
 
242
253
  const isFinished = ref(false);
243
254
 
244
- const showDetail = ref(false);
245
-
246
255
  const network = reactive<DevTool.NetworkItem>({
247
256
  index: 0,
248
257
  url: '',
@@ -257,8 +266,15 @@ const network = reactive<DevTool.NetworkItem>({
257
266
  requestHeader: [],
258
267
  responseHeader: [],
259
268
  },
260
- response: '',
269
+ response: {
270
+ data: undefined,
271
+ statusCode: 0,
272
+ header: {},
273
+ cookies: [],
274
+ errMsg: '',
275
+ },
261
276
  payload: undefined,
277
+ intercepted: false,
262
278
  });
263
279
 
264
280
  const noBodyRequestMethods = ['GET', 'HEAD', 'PATCH', 'OPTIONS'];
@@ -296,14 +312,6 @@ function onChangeUrl(e: any) {
296
312
  queryList.splice(0, queryList.length, ...list);
297
313
  }
298
314
 
299
- function onDetail() {
300
- showDetail.value = true;
301
- }
302
-
303
- function onCloseDetail() {
304
- showDetail.value = false;
305
- }
306
-
307
315
  function onReset() {
308
316
  isFinished.value = false;
309
317
  hasUrl.value = true;
@@ -399,18 +407,17 @@ function onSend() {
399
407
  res?.header?.['Content-Length'] || res?.header?.['content-length'] || 0;
400
408
  network.size = len > 1024 ? (len / 1024).toFixed(2) + 'k' : len + 'b';
401
409
  network.response = res;
402
- network.headers.requestHeader = Object.entries(
410
+ network.headers.requestHeader = objectToArray(
403
411
  requestOptions?.header ?? {},
404
- ).map(([key, value]) => ({
405
- key,
406
- value,
407
- }));
408
- network.headers.responseHeader = Object.entries(res?.header ?? {}).map(
409
- ([key, value]) => ({
410
- key,
411
- value,
412
- }),
413
412
  );
413
+ network.headers.responseHeader = objectToArray(res.header ?? {});
414
+
415
+ network.intercepted =
416
+ props.interceptNetworkList?.some((item) => {
417
+ const key = `${item.method?.toUpperCase()}|${item.url?.split('?')[0]}`;
418
+ const curKey = `${network.method?.toUpperCase()}|${network.url?.split('?')[0]}`;
419
+ return key === curKey;
420
+ }) ?? false;
414
421
 
415
422
  // 完成
416
423
  uni.hideLoading();
@@ -602,12 +609,20 @@ onMounted(() => {
602
609
  top: 0;
603
610
  left: 0;
604
611
  padding: 0 16px;
612
+ /* #ifdef H5 */
613
+ padding: 50px 16px;
614
+ /* #endif */
605
615
  overflow: auto;
606
616
 
607
617
  background-color: var(--dev-tool-bg3-color);
608
618
  box-sizing: border-box;
609
619
  }
610
- .network-send .network-send-control {
620
+ .network-send-form {
621
+ height: calc(100% - 32px - 42px);
622
+ overflow: auto;
623
+ }
624
+
625
+ .network-send-control {
611
626
  display: flex;
612
627
  align-items: center;
613
628
  gap: 12px;
@@ -616,10 +631,10 @@ onMounted(() => {
616
631
  box-sizing: border-box;
617
632
  }
618
633
 
619
- .network-send .network-send-control :deep(.tag) {
634
+ .network-send-control :deep(.tag) {
620
635
  margin-right: 16px;
621
636
  }
622
- .network-send .network-send-control :deep(.tag):last-child {
637
+ .network-send-control :deep(.tag):last-child {
623
638
  margin-right: 0;
624
639
  }
625
640
 
@@ -628,11 +643,12 @@ onMounted(() => {
628
643
  flex-wrap: wrap;
629
644
  }
630
645
 
631
- .radio-group .radio-group-item {
646
+ .radio-group-item {
632
647
  display: flex;
633
648
  align-items: center;
634
649
  width: 25%;
635
650
  margin-bottom: 6px;
651
+ font-size: 12px;
636
652
  }
637
653
 
638
654
  .network-input {
@@ -19,7 +19,8 @@
19
19
  &nbsp;{{ sortMap?.[currentNetworkSort] ?? '一' }}&nbsp;
20
20
  </Tag>
21
21
 
22
- <Tag mode="clear" @click="onOpenSend"> 发起 </Tag>
22
+ <Tag mode="error" @click="emit('openIntercept')"> 拦截 </Tag>
23
+ <Tag mode="primary" @click="emit('openSend')"> 发起 </Tag>
23
24
  <Tag mode="clear" @click="onChoose('clear')"> 清除 </Tag>
24
25
  </view>
25
26
 
@@ -28,6 +29,7 @@
28
29
  :pageSize="15"
29
30
  :height="height"
30
31
  className="network-list"
32
+ v-if="networkList.length > 0"
31
33
  >
32
34
  <template v-slot="{ list, start }">
33
35
  <AutoSize
@@ -41,24 +43,14 @@
41
43
  :currentNetworkSort="currentNetworkSort"
42
44
  :mode="mode"
43
45
  :useDevSource="useDevSource"
44
- @openDetail="onOpenDetail(item)"
45
- @resend="onResend(item)"
46
+ @openDetail="emit('openDetail', item)"
47
+ @resend="emit('openSend', item)"
46
48
  @openCode="emit('openCode', $event)"
47
49
  />
48
50
  </AutoSize>
49
- <Empty v-if="!networkList || networkList.length === 0" />
50
51
  </template>
51
52
  </VirtualListPro>
52
-
53
- <!-- 请求详情 -->
54
- <NetworkDetail
55
- v-if="showDetail"
56
- :network="network"
57
- @close="onCloseDetail"
58
- />
59
-
60
- <!-- 发起请求 -->
61
- <NetworkSend v-if="showSend" :network="network" @close="onCloseSend" />
53
+ <Empty v-else />
62
54
  </view>
63
55
  </template>
64
56
  <script lang="ts" setup>
@@ -70,10 +62,9 @@ import FilterSelect from '../FilterSelect/index.vue';
70
62
  import type { DevTool } from '../../type';
71
63
  import VirtualListPro from '../VirtualListPro/index.vue';
72
64
  import AutoSize from '../VirtualListPro/AutoSize.vue';
73
- import NetworkSend from './NetworkSend.vue';
74
- import NetworkDetail from './NetworkDetail.vue';
65
+
75
66
  import { sortMap } from './const';
76
- import { onMounted, ref, reactive } from 'vue';
67
+ import { onMounted, ref } from 'vue';
77
68
 
78
69
  const props = defineProps<{
79
70
  currentNetworkType: string;
@@ -91,6 +82,9 @@ const emit = defineEmits<{
91
82
  (e: 'search', value: string): void;
92
83
  (e: 'sort', sort: -1 | 1): void;
93
84
  (e: 'openCode', value?: string): void;
85
+ (e: 'openSend', value?: DevTool.NetworkItem): void;
86
+ (e: 'openDetail', value?: DevTool.NetworkItem): void;
87
+ (e: 'openIntercept'): void;
94
88
  }>();
95
89
  const networkFilterItems = [
96
90
  {
@@ -125,29 +119,6 @@ const networkFilterItems = [
125
119
  },
126
120
  ];
127
121
 
128
- const showSend = ref(false);
129
-
130
- const showDetail = ref(false);
131
-
132
- const emptyNetwork = {
133
- index: 0,
134
- url: '',
135
- name: '',
136
- method: '',
137
- status: '',
138
- time: '',
139
- startTime: 0,
140
- endTime: 0,
141
- size: '',
142
- headers: {
143
- requestHeader: [],
144
- responseHeader: [],
145
- },
146
- response: '',
147
- payload: undefined,
148
- };
149
- const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
150
-
151
122
  function onChoose(type: string) {
152
123
  emit('choose', type);
153
124
  }
@@ -158,33 +129,6 @@ onMounted(() => {
158
129
  height.value = windowHeight - 32 - 32;
159
130
  });
160
131
 
161
- function onOpenSend() {
162
- showSend.value = true;
163
- }
164
-
165
- function onCloseSend() {
166
- showSend.value = false;
167
-
168
- Object.assign(network, emptyNetwork);
169
- }
170
-
171
- function onOpenDetail(ni: DevTool.NetworkItem) {
172
- showDetail.value = true;
173
-
174
- Object.assign(network, emptyNetwork);
175
- Object.assign(network, ni);
176
- }
177
- function onCloseDetail() {
178
- showDetail.value = false;
179
- }
180
-
181
- function onResend(ni: DevTool.NetworkItem) {
182
- showSend.value = true;
183
-
184
- Object.assign(network, emptyNetwork);
185
- Object.assign(network, ni);
186
- }
187
-
188
132
  function onSort() {
189
133
  const sort = props.currentNetworkSort === 1 ? -1 : 1;
190
134
  emit('sort', sort);
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view class="setting-content">
3
3
  <view class="setting-item">
4
- <DevToolTitle>DevTool(v0.0.20-vue3)</DevToolTitle>
4
+ <DevToolTitle>DevTool(v0.0.22-vue3)</DevToolTitle>
5
5
  <view class="setting-item-content">
6
6
  <view class="setting-row">
7
7
  <view>显示调试按钮:</view>
@@ -163,15 +163,31 @@
163
163
  <button class="setting-button" @click="onExportLog">导出</button>
164
164
  </view>
165
165
  </view>
166
+ <view class="setting-item">
167
+ <DevToolTitle>请求拦截规则</DevToolTitle>
168
+ <view class="setting-item-content">
169
+ <view class="setting-row">
170
+ <view>缓存拦截规则到本地:</view>
171
+ <checkbox
172
+ :checked="cacheInterceptConfig"
173
+ color="#9254de"
174
+ style="transform: scale(0.8)"
175
+ @click="onCacheInterceptNetworkConfig"
176
+ />
177
+ </view>
178
+ <view class="setting-tips">勾选后将会把 network 拦截缓存到本地</view>
179
+ </view>
180
+ </view>
166
181
  </view>
167
182
  </template>
168
183
  <script lang="ts" setup>
169
184
  import { reactive } from 'vue';
170
185
  import DevToolTitle from '../DevToolTitle/index.vue';
171
- defineProps<{
186
+ const props = defineProps<{
172
187
  devToolVisible?: boolean;
173
188
  sizeFormat?: string;
174
189
  theme?: string;
190
+ cacheInterceptConfig?: boolean;
175
191
  }>();
176
192
  const setting = reactive({
177
193
  restartDevTool: false,
@@ -206,6 +222,7 @@ const emit = defineEmits<{
206
222
  (e: 'clearCache'): void;
207
223
  (e: 'destroyDevTool'): void;
208
224
  (e: 'changeTheme', value: string): void;
225
+ (e: 'changeCacheInterceptConfig', value: boolean): void;
209
226
  }>();
210
227
 
211
228
  function onChangeShowDevButton(show: boolean) {
@@ -243,6 +260,10 @@ function onScreenshot() {
243
260
  function onClearCache() {
244
261
  emit('clearCache');
245
262
  }
263
+
264
+ function onCacheInterceptNetworkConfig() {
265
+ emit('changeCacheInterceptConfig', !props.cacheInterceptConfig);
266
+ }
246
267
  </script>
247
268
  <style scoped>
248
269
  .setting-content {
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <view
3
+ :class="['source-code-line', active ? 'source-code-line-active' : '']"
4
+ :id="id"
5
+ >
6
+ <view class="source-code-line-num" v-if="showNum">{{ num }}</view>
7
+ <view :class="['source-code-line-content', line.class]">
8
+ <view
9
+ v-for="item in line.words"
10
+ :class="['source-code-line-word', item.class]"
11
+ >
12
+ {{ item.word }}
13
+ </view>
14
+ </view>
15
+ </view>
16
+ </template>
17
+ <script lang="ts" setup>
18
+ import type { LineInfo } from './parseCode';
19
+
20
+ const props = withDefaults(
21
+ defineProps<{
22
+ line: LineInfo;
23
+
24
+ id: string;
25
+ active?: boolean;
26
+ num?: number;
27
+ showNum?: boolean;
28
+ }>(),
29
+ {
30
+ showNum: true,
31
+ },
32
+ );
33
+ </script>
34
+ <style lang="scss" scoped>
35
+ .source-code-line {
36
+ display: flex;
37
+ align-items: center;
38
+ height: 24px;
39
+ }
40
+
41
+ .source-code-line-active {
42
+ color: #fff;
43
+ background-color: var(--dev-tool-main-color);
44
+ }
45
+
46
+ .source-code-line-num {
47
+ flex-shrink: 0;
48
+ width: 30px;
49
+ padding: 0 6px;
50
+ margin-right: 6px;
51
+ text-align: right;
52
+ height: 24px;
53
+ border-right: 1px solid var(--dev-tool-border-color);
54
+ }
55
+
56
+ .source-code-line-content {
57
+ display: flex;
58
+ white-space: nowrap;
59
+ height: 24px;
60
+ }
61
+
62
+ .source-code-line-word {
63
+ white-space: nowrap;
64
+ }
65
+
66
+ .source-code-pre-note {
67
+ color: var(--dev-tool-note-color);
68
+ }
69
+
70
+ .source-code-pre-space {
71
+ width: 8px;
72
+ }
73
+
74
+ .source-code-pre-keyword {
75
+ color: var(--dev-tool-keyword-color);
76
+ }
77
+
78
+ .source-code-pre-bracket {
79
+ color: var(--dev-tool-bracket-color);
80
+ }
81
+
82
+ .source-code-pre-quotation {
83
+ color: var(--dev-tool-quotation-color);
84
+ }
85
+
86
+ .source-code-pre-string {
87
+ color: var(--dev-tool-string-color);
88
+ }
89
+
90
+ .source-code-pre-function {
91
+ color: var(--dev-tool-function-color);
92
+ }
93
+
94
+ .source-code-pre-attribute {
95
+ color: var(--dev-tool-attribute-color);
96
+ }
97
+
98
+ .source-code-pre-operator {
99
+ color: var(--dev-tool-operator-color);
100
+ }
101
+ </style>
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <view class="dev-tool-code" :style="{ zIndex: zIndex }">
3
3
  <view class="dev-tool-code-control">
4
- <FilterInput
4
+ <!-- <FilterInput
5
5
  v-model="modelValue"
6
6
  style="width: 100%"
7
7
  @search="onSearch"
8
- />
8
+ /> -->
9
+ <view class="dev-tool-code-title">{{ fileName }}</view>
9
10
  <CircularButton style="margin-left: auto" text="×" @click="onClose" />
10
11
  </view>
11
- <view class="dev-tool-code-title">{{ fileName }}</view>
12
12
 
13
13
  <VirtualListPro
14
14
  v-if="codes.length > 0"
@@ -17,8 +17,6 @@
17
17
  :height="height"
18
18
  :data="codes"
19
19
  :scrollWithAnimation="true"
20
- :defaultCurrent="defaultCurrent"
21
- :scrollIntoView="scrollIntoView"
22
20
  >
23
21
  <template #default="{ list, current, start }">
24
22
  <AutoSize
@@ -26,18 +24,12 @@
26
24
  :key="start + index"
27
25
  :index="start + index"
28
26
  >
29
- <view
27
+ <Line
28
+ :line="code"
30
29
  :id="`dev-code-${start + index}`"
31
- :class="`dev-tool-code-item ${start + index === activeRowCol.row ? 'dev-tool-code-item-active' : ''}`"
32
- >
33
- <view class="dev-tool-code-item-index">
34
- {{ start + index + 1 }}
35
- </view>
36
-
37
- <view class="dev-tool-code-item-content">
38
- {{ code }}
39
- </view>
40
- </view>
30
+ :num="start + index + 1"
31
+ :active="start + index === activeRowCol.row"
32
+ />
41
33
  </AutoSize>
42
34
  </template>
43
35
  </VirtualListPro>
@@ -46,13 +38,14 @@
46
38
  </template>
47
39
  <script lang="ts" setup>
48
40
  import { computed, ref, onMounted } from 'vue';
49
- import FilterInput from '../FilterInput/index.vue';
41
+ // import FilterInput from '../FilterInput/index.vue';
50
42
  import CircularButton from '../CircularButton/index.vue';
51
43
  import VirtualListPro from '../VirtualListPro/index.vue';
52
44
  import Empty from '../Empty/index.vue';
53
45
  import AutoSize from '../VirtualListPro/AutoSize.vue';
54
- import { hightLight, isAndroid, parseStock } from '../../utils';
55
-
46
+ import Line from './Line.vue';
47
+ import { isAndroid, parseStock } from '../../utils';
48
+ import { parseCode, type LineInfo } from './parseCode';
56
49
  const props = defineProps<{
57
50
  url: string;
58
51
  sourceFileServers?: string[];
@@ -62,7 +55,7 @@ const props = defineProps<{
62
55
 
63
56
  const emit = defineEmits<{ (e: 'close'): void }>();
64
57
 
65
- const modelValue = ref('');
58
+ // const modelValue = ref('');
66
59
  const height = ref(0);
67
60
  const fileName = computed(() => {
68
61
  const name =
@@ -73,20 +66,20 @@ const fileName = computed(() => {
73
66
  const activeRowCol = ref({ row: -1, col: -1, activeRow: -1 });
74
67
  const scrollIntoView = ref('');
75
68
 
76
- let backupCodes: string[] = [];
69
+ // let backupCodes: string[] = [];
77
70
 
78
- const codes = ref<string[]>([]);
79
- const defaultCurrent = ref(1);
80
- const pageSize = 25;
71
+ const codes = ref<LineInfo[]>([]);
72
+ // const defaultCurrent = ref(1);
73
+ const pageSize = 50;
81
74
 
82
75
  function onClose() {
83
76
  emit('close');
84
77
  }
85
78
 
86
79
  function onSearch(value: string) {
87
- codes.value = backupCodes.map((code) => {
88
- return hightLight(code, value);
89
- });
80
+ // codes.value = backupCodes.map((code) => {
81
+ // return hightLight(code, value);
82
+ // });
90
83
  }
91
84
 
92
85
  let timer: number;
@@ -139,24 +132,26 @@ function getCode(url: string, i: number = 0) {
139
132
  url: allUrl,
140
133
  success: (res) => {
141
134
  if (typeof res.data === 'string') {
142
- codes.value = res.data?.split('\n') ?? [];
135
+ codes.value = parseCode(res.data ?? '');
136
+
137
+ // res.data?.split('\n') ?? [];
143
138
 
144
139
  // 缓慢显示
145
140
  const row = activeRowCol.value.row;
146
141
  // defaultCurrent.value = Math.ceil(activeRowCol.value.row / pageSize);
147
142
  const targetCurrent = Math.ceil(row / pageSize);
148
143
 
149
- startCounter({
150
- start: 1,
151
- target: targetCurrent,
152
- duration: 500,
153
- onExecute(current) {
154
- scrollIntoView.value = `dev-code-${current * pageSize - 1}`;
155
- },
156
- onSuccess() {
157
- // scrollIntoView.value = `dev-code-${row}`;
158
- },
159
- });
144
+ // startCounter({
145
+ // start: 1,
146
+ // target: targetCurrent,
147
+ // duration: 500,
148
+ // onExecute(current) {
149
+ // scrollIntoView.value = `dev-code-${current * pageSize - 1}`;
150
+ // },
151
+ // onSuccess() {
152
+ // // scrollIntoView.value = `dev-code-${row}`;
153
+ // },
154
+ // });
160
155
  }
161
156
  },
162
157
  fail: (err) => {
@@ -185,7 +180,7 @@ function getSourceCodeDev(url: string) {
185
180
  onMounted(() => {
186
181
  const { windowHeight } = uni.getWindowInfo();
187
182
 
188
- height.value = windowHeight - 32 - 32 - 32;
183
+ height.value = windowHeight - 32 - 32;
189
184
 
190
185
  let url = props?.url;
191
186
 
@@ -211,7 +206,6 @@ onMounted(() => {
211
206
  position: fixed;
212
207
  top: 0;
213
208
  left: 0;
214
- z-index: 1001;
215
209
  padding: 0 16px;
216
210
  /* #ifdef H5 */
217
211
  padding: 50px 16px;
@@ -253,25 +247,4 @@ onMounted(() => {
253
247
  .dev-tool-code-list {
254
248
  height: calc(100% - 68px);
255
249
  }
256
-
257
- .dev-tool-code-item {
258
- display: flex;
259
- align-items: center;
260
- height: 28px;
261
- }
262
- .dev-tool-code-item-active {
263
- color: #fff;
264
- background-color: var(--dev-tool-main-color);
265
- }
266
-
267
- .dev-tool-code-item-index {
268
- flex-shrink: 0;
269
- width: 20px;
270
- margin-right: 8px;
271
- text-align: right;
272
- }
273
-
274
- .dev-tool-code-item-content {
275
- white-space: pre;
276
- }
277
250
  </style>