vite-uni-dev-tool 1.1.0 → 1.2.0

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 (135) hide show
  1. package/README.md +8 -0
  2. package/dist/const.cjs +1 -1
  3. package/dist/const.d.ts +1 -0
  4. package/dist/const.d.ts.map +1 -1
  5. package/dist/const.js +1 -1
  6. package/dist/core.d.ts.map +1 -1
  7. package/dist/core.js +2 -2
  8. package/dist/i18n/locales/en.cjs +1 -1
  9. package/dist/i18n/locales/en.d.ts +5 -0
  10. package/dist/i18n/locales/en.d.ts.map +1 -1
  11. package/dist/i18n/locales/en.js +1 -1
  12. package/dist/i18n/locales/zh-Hans.cjs +1 -1
  13. package/dist/i18n/locales/zh-Hans.d.ts +5 -0
  14. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
  15. package/dist/i18n/locales/zh-Hans.js +1 -1
  16. package/dist/modules/devIntercept/index.cjs +9 -9
  17. package/dist/modules/devIntercept/index.d.ts +1 -1
  18. package/dist/modules/devIntercept/index.d.ts.map +1 -1
  19. package/dist/modules/devIntercept/index.js +9 -9
  20. package/dist/modules/devStore/index.cjs +1 -1
  21. package/dist/modules/devStore/index.d.ts.map +1 -1
  22. package/dist/modules/devStore/index.js +1 -1
  23. package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -3
  24. package/dist/plugins/uniDevTool/transform/transformMain.d.ts +2 -1
  25. package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
  26. package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
  27. package/dist/plugins/uniDevTool/transform/transformVue.cjs +31 -25
  28. package/dist/plugins/uniDevTool/transform/transformVue.d.ts +2 -1
  29. package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
  30. package/dist/plugins/uniDevTool/transform/transformVue.js +30 -24
  31. package/dist/plugins/uniDevTool/uniDevTool.cjs +3 -3
  32. package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -1
  33. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  34. package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
  35. package/dist/type.d.ts +3 -0
  36. package/dist/type.d.ts.map +1 -1
  37. package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -199
  38. package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -730
  39. package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -167
  40. package/dist/v3/DevTool/components/CaptureScreen/index.vue +109 -109
  41. package/dist/v3/DevTool/components/ConsoleList/ConsoleItem.vue +230 -225
  42. package/dist/v3/DevTool/components/ConsoleList/RunJSInput.vue +247 -247
  43. package/dist/v3/DevTool/components/ConsoleList/index.vue +171 -171
  44. package/dist/v3/DevTool/components/ConsoleList/staticTips.ts +1145 -1145
  45. package/dist/v3/DevTool/components/DevToolTitle/index.vue +24 -24
  46. package/dist/v3/DevTool/components/DevToolWindow/DevToolOverlay.vue +197 -197
  47. package/dist/v3/DevTool/components/DevToolWindow/hooks/dataUtils.ts +48 -48
  48. package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolData.ts +387 -387
  49. package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolHandlers.ts +629 -629
  50. package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolOverlay.ts +201 -197
  51. package/dist/v3/DevTool/components/ElEvent/ElEventItem.vue +105 -105
  52. package/dist/v3/DevTool/components/ElEvent/index.vue +106 -106
  53. package/dist/v3/DevTool/components/Instance/components/InstanceTreeNode.vue +265 -265
  54. package/dist/v3/DevTool/components/Instance/flatten.ts +226 -226
  55. package/dist/v3/DevTool/components/Instance/index.vue +94 -94
  56. package/dist/v3/DevTool/components/Instance/registry.ts +49 -49
  57. package/dist/v3/DevTool/components/Instance/transformTree.ts +375 -375
  58. package/dist/v3/DevTool/components/Instance/transformTreeCtx.ts +268 -268
  59. package/dist/v3/DevTool/components/Instance/typing.d.ts +43 -43
  60. package/dist/v3/DevTool/components/InstanceDetail/index.vue +485 -485
  61. package/dist/v3/DevTool/components/JsonDetail/index.vue +70 -70
  62. package/dist/v3/DevTool/components/NFCList/NFCItem.vue +112 -112
  63. package/dist/v3/DevTool/components/NFCList/NFCTool.vue +454 -454
  64. package/dist/v3/DevTool/components/NFCList/const.ts +56 -56
  65. package/dist/v3/DevTool/components/NFCList/index.vue +94 -94
  66. package/dist/v3/DevTool/components/NetworkList/InterceptConfig.vue +624 -624
  67. package/dist/v3/DevTool/components/NetworkList/InterceptItem.vue +140 -140
  68. package/dist/v3/DevTool/components/NetworkList/NetworkDetail.vue +287 -287
  69. package/dist/v3/DevTool/components/NetworkList/NetworkIntercept.vue +88 -88
  70. package/dist/v3/DevTool/components/NetworkList/NetworkItem.vue +163 -163
  71. package/dist/v3/DevTool/components/NetworkList/NetworkSend.vue +589 -589
  72. package/dist/v3/DevTool/components/NetworkList/const.ts +4 -4
  73. package/dist/v3/DevTool/components/NetworkList/hooks/useNetworkForm.ts +86 -86
  74. package/dist/v3/DevTool/components/NetworkList/index.vue +160 -160
  75. package/dist/v3/DevTool/components/NetworkList/utils.ts +101 -101
  76. package/dist/v3/DevTool/components/Performance/index.vue +498 -498
  77. package/dist/v3/DevTool/components/Performance/modules/PerformanceMetrics.vue +153 -153
  78. package/dist/v3/DevTool/components/Performance/modules/usePerformanceChart.ts +460 -460
  79. package/dist/v3/DevTool/components/Performance/modules/usePerformanceData.ts +258 -258
  80. package/dist/v3/DevTool/components/PiniaList/index.vue +93 -93
  81. package/dist/v3/DevTool/components/RunJS/index.vue +148 -148
  82. package/dist/v3/DevTool/components/ScanCodeList/ScanCodeItem.vue +97 -97
  83. package/dist/v3/DevTool/components/ScanCodeList/index.vue +100 -100
  84. package/dist/v3/DevTool/components/SettingButton/index.vue +45 -45
  85. package/dist/v3/DevTool/components/SettingList/index.vue +218 -218
  86. package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -304
  87. package/dist/v3/DevTool/components/SettingList/modules/SettingDevTool.vue +212 -212
  88. package/dist/v3/DevTool/components/SettingList/modules/SettingInfo.vue +157 -157
  89. package/dist/v3/DevTool/components/SettingList/modules/SettingLanguage.vue +74 -74
  90. package/dist/v3/DevTool/components/SettingList/modules/SettingLog.vue +230 -230
  91. package/dist/v3/DevTool/components/SettingList/typing.d.ts +2 -2
  92. package/dist/v3/DevTool/components/SourceCode/Line.vue +127 -127
  93. package/dist/v3/DevTool/components/SourceCode/parseCode.ts +609 -609
  94. package/dist/v3/DevTool/components/StorageList/index.vue +174 -174
  95. package/dist/v3/DevTool/components/TransferList/TransferDetail.vue +268 -268
  96. package/dist/v3/DevTool/components/VuexList/index.vue +84 -84
  97. package/dist/v3/DevTool/index.vue +1 -0
  98. package/dist/v3/components/AppTransition/index.vue +176 -176
  99. package/dist/v3/components/AutoSizer/index.vue +192 -192
  100. package/dist/v3/components/AutoSizer/index1.vue +184 -184
  101. package/dist/v3/components/AutoSizer/utils.ts +49 -49
  102. package/dist/v3/components/Barrage/BarrageItem.vue +137 -137
  103. package/dist/v3/components/Barrage/index.vue +202 -202
  104. package/dist/v3/components/CircularButton/index.vue +84 -84
  105. package/dist/v3/components/CustomSwiper/CustomSwiperItem.vue +49 -49
  106. package/dist/v3/components/CustomSwiper/index.vue +104 -104
  107. package/dist/v3/components/DevErrorBoundary/index.vue +380 -0
  108. package/dist/v3/components/Empty/index.vue +29 -29
  109. package/dist/v3/components/FilterSelect/index.vue +179 -179
  110. package/dist/v3/components/JsonPretty/components/Brackets/index.vue +27 -27
  111. package/dist/v3/components/JsonPretty/components/Carets/index.vue +59 -59
  112. package/dist/v3/components/JsonPretty/components/CheckController/index.vue +136 -136
  113. package/dist/v3/components/JsonPretty/components/TreeNode/index.vue +387 -387
  114. package/dist/v3/components/JsonPretty/hooks/useClipboard.ts +21 -21
  115. package/dist/v3/components/JsonPretty/hooks/useError.ts +21 -21
  116. package/dist/v3/components/JsonPretty/type.ts +127 -127
  117. package/dist/v3/components/JsonPretty/utils/index.ts +169 -169
  118. package/dist/v3/components/MovableContainer/index.vue +8 -4
  119. package/dist/v3/components/Pick/index.vue +322 -322
  120. package/dist/v3/components/Tag/index.vue +113 -113
  121. package/dist/v3/components/VirtualList/AutoSize.vue +40 -40
  122. package/dist/v3/components/VirtualList/index.vue +416 -416
  123. package/dist/v3/hooks/useBluetooth/index.ts +561 -561
  124. package/dist/v3/hooks/useContainerStyle.ts +153 -153
  125. package/dist/v3/hooks/useNFC/index.ts +107 -107
  126. package/dist/v3/hooks/useNFC/typing.d.ts +396 -396
  127. package/dist/v3/hooks/useNFC/useNFCAndroid.ts +966 -966
  128. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +812 -812
  129. package/dist/v3/hooks/useNFC/utils.ts +754 -754
  130. package/dist/v3/hooks/useRequest/index.ts +586 -586
  131. package/dist/v3/hooks/useRequest/utils.ts +267 -267
  132. package/dist/v3/hooks/useScanCode/index.ts +206 -206
  133. package/dist/v3/hooks/useWebsocket/index.ts +253 -253
  134. package/dist/v3/styles/theme.ts +12 -12
  135. package/package.json +9 -1
@@ -1,624 +1,624 @@
1
- <template>
2
- <view class="intercept-config" :style="customStyle">
3
- <view class="intercept-config-control">
4
- <DevToolTitle>{{ t('network.interceptConfig') }}</DevToolTitle>
5
- <CircularButton style="margin-left: auto" text="×" @click="onClose" />
6
- </view>
7
-
8
- <scroll-view scroll-y class="intercept-config-form">
9
- <view class="intercept-config-tip">
10
- {{ t('network.tipsIntercept') }}
11
- </view>
12
- <view class="intercept-config-control">
13
- <DevToolTitle>{{ t('network.timeout') }}</DevToolTitle>
14
- </view>
15
- <input
16
- class="intercept-input"
17
- :value="state.timeout"
18
- @input="onChangeState($event, 'timeout')" />
19
- <view class="intercept-config-tip">
20
- {{ t('network.tipsTimeout') }}
21
- </view>
22
- <view class="intercept-config-control">
23
- <DevToolTitle>
24
- {{ t('network.delay') }}
25
- </DevToolTitle>
26
- </view>
27
- <input
28
- class="intercept-input"
29
- :value="state.delay"
30
- @input="onChangeState($event, 'delay')" />
31
- <view class="intercept-config-tip">
32
- {{ t('network.tipsDelay') }}
33
- </view>
34
- <view class="intercept-config-control">
35
- <DevToolTitle>{{ t('network.responseStatus') }}</DevToolTitle>
36
- </view>
37
- <input
38
- class="intercept-input"
39
- :value="state.status"
40
- @input="onChangeState($event, 'status')" />
41
- <view class="intercept-config-control">
42
- <DevToolTitle>{{ t('network.requestMethod') }}</DevToolTitle>
43
- </view>
44
- <radio-group class="radio-group" @change="onChangeRequestMethod">
45
- <label
46
- class="radio-group-item"
47
- v-for="item in requestMethods"
48
- :key="item.value">
49
- <radio
50
- size
51
- style="transform: scale(0.8)"
52
- :color="themeColor"
53
- :value="item.value"
54
- :checked="item.value === state.method" />
55
-
56
- <view>{{ item.name }}</view>
57
- </label>
58
- </radio-group>
59
-
60
- <view class="intercept-config-control">
61
- <DevToolTitle>{{ t('network.requestHeaders') }}</DevToolTitle>
62
- <CircularButton
63
- style="margin-left: auto"
64
- text="+"
65
- @click="onAddRequestHeader" />
66
- </view>
67
-
68
- <view class="intercept-header-list">
69
- <checkbox-group
70
- v-if="requestHeaderList.length > 0"
71
- key="requestHeaderList"
72
- @change="onChangeRequestHeaderChecked">
73
- <view
74
- class="intercept-header-item"
75
- v-for="(item, index) in requestHeaderList"
76
- :key="item.id">
77
- <checkbox
78
- :color="themeColor"
79
- :value="item.id"
80
- :checked="item.checked" />
81
- <input
82
- class="intercept-input"
83
- :placeholder="t('network.placeholderHeaderName')"
84
- :value="item.key"
85
- @input="onChangeRequestHeader($event, 'key', index)" />
86
- <input
87
- class="intercept-input"
88
- :placeholder="t('network.placeholderHeaderValue')"
89
- :value="item.value"
90
- @input="onChangeRequestHeader($event, 'value', index)" />
91
- <CircularButton
92
- style="margin-left: 6px"
93
- text="一"
94
- @click="onDeleteRequestHeader(item)" />
95
- </view>
96
- </checkbox-group>
97
-
98
- <view class="intercept-empty" v-else>
99
- {{ t('network.noRequestHeaders') }}
100
- </view>
101
- </view>
102
-
103
- <view class="intercept-config-control">
104
- <DevToolTitle>{{ t('network.responseHeaders') }}</DevToolTitle>
105
- <CircularButton
106
- style="margin-left: auto"
107
- text="+"
108
- @click="onAddResponseHeader" />
109
- </view>
110
-
111
- <view class="intercept-header-list">
112
- <checkbox-group
113
- v-if="responseHeaderList.length > 0"
114
- key="responseHeaderList"
115
- @change="onChangeResponseHeaderChecked">
116
- <view
117
- class="intercept-header-item"
118
- v-for="(item, index) in responseHeaderList"
119
- :key="item.id">
120
- <checkbox
121
- :color="themeColor"
122
- :value="item.id"
123
- :checked="item.checked" />
124
- <input
125
- class="intercept-input"
126
- :placeholder="t('network.placeholderRespHeaderName')"
127
- :value="item.key"
128
- @input="onChangeResponseHeader($event, 'key', index)" />
129
- <input
130
- class="intercept-input"
131
- :placeholder="t('network.placeholderRespHeaderValue')"
132
- :value="item.value"
133
- @input="onChangeResponseHeader($event, 'value', index)" />
134
- <CircularButton
135
- style="margin-left: 6px"
136
- text="一"
137
- @click="onDeleteResponseHeader(item)" />
138
- </view>
139
- </checkbox-group>
140
-
141
- <view class="intercept-empty" v-else>
142
- {{ t('network.noResponseHeaders') }}
143
- </view>
144
- </view>
145
- <DevToolTitle>{{ t('network.requestUrl') }}</DevToolTitle>
146
- <textarea
147
- :placeholder="t('network.placeholderUrl')"
148
- class="intercept-textarea"
149
- :value="state.url"
150
- @input="onChangeUrl" />
151
- <view class="form-error-message">
152
- {{ hasUrl ? '' : t('network.toastEnterUrl') }}
153
- </view>
154
-
155
- <view class="intercept-config-control">
156
- <DevToolTitle>{{ t('network.requestParams') }}</DevToolTitle>
157
- <CircularButton
158
- style="margin-left: auto"
159
- text="+"
160
- @click="onAddQuery" />
161
- </view>
162
- <view class="intercept-param-list">
163
- <checkbox-group
164
- v-if="queryList.length > 0"
165
- @change="handleQueryCheckedChange">
166
- <view
167
- class="intercept-param-item"
168
- v-for="(item, index) in queryList"
169
- :key="item.id">
170
- <checkbox
171
- :color="themeColor"
172
- :checked="item.checked"
173
- :value="item.id" />
174
- <input
175
- class="intercept-input"
176
- :placeholder="t('network.placeholderParamName')"
177
- :value="item.key"
178
- @input="onChangeQuery($event, 'key', index)" />
179
- <input
180
- class="intercept-input"
181
- :placeholder="t('network.placeholderParamValue')"
182
- :value="item.value"
183
- @input="onChangeQuery($event, 'value', index)" />
184
- <CircularButton
185
- text="一"
186
- style="margin-left: 6px"
187
- @click="onDeleteQuery(item)" />
188
- </view>
189
- </checkbox-group>
190
-
191
- <view class="intercept-empty" v-else>
192
- {{ t('network.emptyParams') }}
193
- </view>
194
- </view>
195
-
196
- <template v-if="!noBodyRequestMethods.includes(state.method)">
197
- <view class="intercept-config-control">
198
- <DevToolTitle>{{ t('network.requestBody') }}</DevToolTitle>
199
- </view>
200
-
201
- <textarea
202
- :placeholder="t('network.placeholderBody')"
203
- class="intercept-textarea"
204
- :value="state.bodyText"
205
- @input="onChangeState($event, 'bodyText')" />
206
- </template>
207
-
208
- <view class="intercept-config-control">
209
- <DevToolTitle>{{ t('network.responseBody') }}</DevToolTitle>
210
- </view>
211
- <textarea
212
- :placeholder="t('network.placeholderRespBody')"
213
- class="intercept-textarea"
214
- :value="state.responseText"
215
- @input="onChangeState($event, 'responseText')" />
216
- </scroll-view>
217
- <view class="intercept-config-buttons">
218
- <SettingButton @click="onConfirm">
219
- {{ t('network.saveConfig') }}
220
- </SettingButton>
221
- </view>
222
- </view>
223
- </template>
224
- <script lang="ts" setup>
225
- import { computed, ref, onMounted } from 'vue';
226
- import CircularButton from '../../../components/CircularButton/index.vue';
227
- import DevToolTitle from '../DevToolTitle/index.vue';
228
- import type { DevTool } from '../../../../type';
229
- import SettingButton from '../SettingButton/index.vue';
230
- import { useI18n } from '../../../../i18n';
231
- import { getThemeMainColor } from '../../../styles/theme';
232
- const { t } = useI18n();
233
-
234
- const themeColor = computed(() => getThemeMainColor(props.theme));
235
-
236
- const props = defineProps<{
237
- theme?: string;
238
- network: DevTool.NetworkItem;
239
- zIndex?: number;
240
- customStyle?: Record<string, any>;
241
- }>();
242
-
243
- const emit = defineEmits<{
244
- (e: 'close'): void;
245
- (e: 'openDetail', v: DevTool.NetworkItem): void;
246
- (e: 'confirm', v: DevTool.NetworkItem): void;
247
- }>();
248
-
249
- import {
250
- requestMethods,
251
- noBodyRequestMethods,
252
- defaultHeader,
253
- arrayToObject,
254
- objectToArray,
255
- arrayToUrlParams,
256
- urlParamsToObject,
257
- unionArrayByKey,
258
- } from './utils';
259
- import { useKeyValueList, useNetworkState } from './hooks/useNetworkForm';
260
-
261
- const { state, hasUrl, onChangeState, parseUrlToList, parseListToUrl } =
262
- useNetworkState({
263
- method: 'GET',
264
- url: 'http://mock.view-uni-dev-tool/a?a=123',
265
- status: 200,
266
- bodyText: '',
267
- responseText: '',
268
- timeout: 3 * 1000,
269
- delay: 0,
270
- });
271
-
272
- const {
273
- list: requestHeaderList,
274
- onAdd: onAddRequestHeader,
275
- onDelete: onDeleteRequestHeader,
276
- onChangeChecked: onChangeRequestHeaderChecked,
277
- onChangeValue: onChangeRequestHeaderItem,
278
- setList: setRequestHeaderList,
279
- } = useKeyValueList(defaultHeader);
280
-
281
- const {
282
- list: responseHeaderList,
283
- onAdd: onAddResponseHeader,
284
- onDelete: onDeleteResponseHeader,
285
- onChangeChecked: onChangeResponseHeaderChecked,
286
- onChangeValue: onChangeResponseHeaderItem,
287
- setList: setResponseHeaderList,
288
- } = useKeyValueList(defaultHeader);
289
-
290
- const {
291
- list: queryList,
292
- onAdd: onAddQuery,
293
- onDelete: onDeleteQuery,
294
- onChangeChecked: onChangeQueryChecked,
295
- onChangeValue: onChangeQueryItem,
296
- setList: setQueryList,
297
- } = useKeyValueList([
298
- {
299
- id: '1',
300
- key: 'a',
301
- value: '123',
302
- checked: true,
303
- },
304
- ]);
305
-
306
- const isFinished = ref(false);
307
-
308
- function onChangeUrl(e: any) {
309
- const url = e.detail.value;
310
- state.url = url;
311
- const list = parseUrlToList(url);
312
- setQueryList(list);
313
- }
314
-
315
- function onReset() {
316
- isFinished.value = false;
317
- hasUrl.value = true;
318
- state.method = 'GET';
319
- state.url = '';
320
- state.bodyText = '';
321
- setResponseHeaderList(defaultHeader);
322
- setQueryList([]);
323
- }
324
-
325
- function onClose() {
326
- emit('close');
327
- onReset();
328
- }
329
-
330
- function onConfirm() {
331
- if (!state.url) {
332
- hasUrl.value = false;
333
- uni.showToast({
334
- title: t('network.toastEnterUrl'),
335
- icon: 'none',
336
- });
337
- return;
338
- }
339
- hasUrl.value = true;
340
-
341
- const responseHeader = arrayToObject(responseHeaderList);
342
- const query = arrayToUrlParams(queryList.filter((q) => q.checked));
343
-
344
- const baseUrl = state.url?.split('?')[0] || '';
345
- const lastSlashIndex = baseUrl.lastIndexOf('/');
346
- const name = lastSlashIndex !== -1 ? baseUrl.slice(lastSlashIndex + 1) : '';
347
-
348
- const interceptConfig: DevTool.NetworkItem = {
349
- index: 0,
350
-
351
- name,
352
- url: state.url,
353
- method: state.method,
354
- timeout: state.timeout,
355
- delay: state.delay,
356
- status: state.status as string,
357
- time: '',
358
- startTime: 0,
359
- endTime: 0,
360
- size: '',
361
- headers: {
362
- requestHeader: requestHeaderList,
363
- responseHeader: responseHeaderList,
364
- },
365
- response: {
366
- data: '',
367
- statusCode: Number(state.status),
368
- header: responseHeader,
369
- cookies: [],
370
- errMsg: 'request:ok',
371
- },
372
- payload: {},
373
- };
374
-
375
- if (noBodyRequestMethods.includes(state.method)) {
376
- // 不支持携带 body 参数
377
-
378
- interceptConfig.payload = {};
379
- } else {
380
- // 支持 url 中携带参数
381
-
382
- if (state.url.includes('?')) {
383
- interceptConfig.url = state.url + '&' + query;
384
- } else {
385
- interceptConfig.url = state.url + '?' + query;
386
- }
387
-
388
- // 支持携带 body 参数
389
- if (state.bodyText?.trim()) {
390
- try {
391
- const bodyJson = JSON.parse(state.bodyText);
392
- interceptConfig.payload = bodyJson;
393
- } catch (_error) {
394
- uni.showToast({
395
- title: t('network.toastBodyJson'),
396
- icon: 'none',
397
- });
398
- return;
399
- }
400
- }
401
- }
402
-
403
- if (state.responseText?.trim()) {
404
- try {
405
- const bodyJson = JSON.parse(state.responseText);
406
- interceptConfig.response.data = bodyJson;
407
- } catch (_error) {
408
- uni.showToast({
409
- title: t('network.toastRespJson'),
410
- icon: 'none',
411
- });
412
- return;
413
- }
414
- }
415
-
416
- uni.showToast({
417
- icon: 'none',
418
- title: t('network.toastSaveSuccess'),
419
- });
420
-
421
- emit('confirm', interceptConfig);
422
- emit('close');
423
- }
424
-
425
- function onChangeRequestMethod(e: any) {
426
- const method = e.detail.value;
427
- state.method = method;
428
- }
429
-
430
- function onChangeRequestHeader(e: any, key: 'key' | 'value', index: number) {
431
- onChangeRequestHeaderItem(index, key, e.detail.value);
432
- }
433
-
434
- function onChangeResponseHeader(e: any, key: 'key' | 'value', index: number) {
435
- onChangeResponseHeaderItem(index, key, e.detail.value);
436
- }
437
-
438
- function handleQueryCheckedChange(e: any) {
439
- onChangeQueryChecked(e);
440
- state.url = parseListToUrl(state.url, queryList);
441
- }
442
-
443
- function onChangeQuery(e: any, key: 'key' | 'value', index: number) {
444
- onChangeQueryItem(index, key, e.detail.value);
445
- state.url = parseListToUrl(state.url, queryList);
446
- }
447
-
448
- /**
449
- * 处理规格
450
- */
451
- function handleInterceptConfig() {
452
- // 如果没有网络数据或尚未开始,则直接返回
453
- if (!props.network || !props.network.url) return;
454
-
455
- // 设置基础请求信息
456
- state.url = props.network.url;
457
- state.method = props.network.method?.toUpperCase() ?? 'GET';
458
- state.status = props.network.status as string;
459
- state.delay = props.network.delay ?? 0;
460
-
461
- // 初始化请求头
462
- const requestHeaders =
463
- props.network.headers?.requestHeader?.map((item, index) => {
464
- return {
465
- ...item,
466
- id: index.toString(),
467
- checked: true,
468
- };
469
- }) ?? [];
470
-
471
- setRequestHeaderList(requestHeaders);
472
-
473
- const responseHeaders =
474
- props.network.headers?.responseHeader?.map((item, index) => {
475
- return {
476
- ...item,
477
- id: index.toString(),
478
- checked: true,
479
- };
480
- }) ?? [];
481
-
482
- setResponseHeaderList(responseHeaders);
483
-
484
- setQueryList([]);
485
-
486
- // 解析参数
487
- if (noBodyRequestMethods.includes(state.method)) {
488
- // 参数在 query 中
489
- if (props.network.url.includes('?')) {
490
- const urlParams = objectToArray(
491
- urlParamsToObject(props.network.url.split('?')?.[1] ?? ''),
492
- );
493
- const payloadParams = objectToArray(props.network.payload);
494
-
495
- const list = unionArrayByKey(urlParams, payloadParams, 'key');
496
-
497
- setQueryList(list);
498
- }
499
- } else {
500
- // 参数在 query 中
501
- if (props.network.url.includes('?')) {
502
- const urlParams = objectToArray(
503
- urlParamsToObject(props.network.url.split('?')?.[1] ?? ''),
504
- );
505
- setQueryList(urlParams);
506
- }
507
- state.bodyText = JSON.stringify(props.network.payload);
508
- }
509
-
510
- if (props.network.response?.data) {
511
- try {
512
- state.responseText = JSON.stringify(props.network.response.data);
513
- } catch (_error) {
514
- state.responseText = props.network.response.data as string;
515
- }
516
- }
517
- }
518
-
519
- onMounted(() => {
520
- handleInterceptConfig();
521
- });
522
- </script>
523
-
524
- <style scoped>
525
- .intercept-config {
526
- position: fixed;
527
- width: 100vw;
528
- height: 100%;
529
- z-index: 5;
530
- top: 0;
531
- left: 0;
532
- padding: 0 16px;
533
-
534
- /* #ifdef H5 || APP-PLUS */
535
- padding: 50px 16px;
536
-
537
- /* #endif */
538
- overflow: auto;
539
- background-color: var(--dev-tool-bg3-color);
540
- box-sizing: border-box;
541
- }
542
-
543
- .intercept-config-tip {
544
- font-size: var(--dev-tool-tips-font-size);
545
- color: var(--dev-tool-info-color);
546
- }
547
-
548
- .intercept-config-form {
549
- height: calc(100% - 32px - 42px);
550
- overflow: auto;
551
- }
552
-
553
- .intercept-config-control {
554
- display: flex;
555
- align-items: center;
556
- gap: 12px;
557
- height: 32px;
558
- border-bottom: 1px solid transparent;
559
- box-sizing: border-box;
560
- }
561
-
562
- .radio-group {
563
- display: flex;
564
- flex-wrap: wrap;
565
- }
566
-
567
- .radio-group-item {
568
- display: flex;
569
- align-items: center;
570
- width: 25%;
571
- margin-bottom: 6px;
572
- }
573
-
574
- .intercept-input {
575
- padding: 0 6px;
576
- height: 24px;
577
- border: 1px solid var(--dev-tool-border-color);
578
- }
579
-
580
- .intercept-textarea {
581
- padding: 6px;
582
- width: 100%;
583
- box-sizing: border-box;
584
- border: 1px solid var(--dev-tool-border-color);
585
- }
586
-
587
- .form-error-message {
588
- padding: 0 6px;
589
- height: 24px;
590
- line-height: 24px;
591
- color: red;
592
- }
593
-
594
- .intercept-header-item {
595
- display: flex;
596
- align-items: center;
597
- }
598
-
599
- .intercept-empty {
600
- color: var(--dev-tool-info-color);
601
- text-align: center;
602
- }
603
-
604
- .intercept-param-item {
605
- display: flex;
606
- align-items: center;
607
- }
608
-
609
- .intercept-body-data-item {
610
- display: flex;
611
- align-items: center;
612
- }
613
-
614
- .intercept-config-buttons {
615
- position: sticky;
616
- display: flex;
617
- justify-content: space-between;
618
-
619
- /* gap: 6px; */
620
- width: 100%;
621
- margin-top: 12px;
622
- background-color: var(--dev-tool-bg3-color);
623
- }
624
- </style>
1
+ <template>
2
+ <view class="intercept-config" :style="customStyle">
3
+ <view class="intercept-config-control">
4
+ <DevToolTitle>{{ t('network.interceptConfig') }}</DevToolTitle>
5
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
6
+ </view>
7
+
8
+ <scroll-view scroll-y class="intercept-config-form">
9
+ <view class="intercept-config-tip">
10
+ {{ t('network.tipsIntercept') }}
11
+ </view>
12
+ <view class="intercept-config-control">
13
+ <DevToolTitle>{{ t('network.timeout') }}</DevToolTitle>
14
+ </view>
15
+ <input
16
+ class="intercept-input"
17
+ :value="state.timeout"
18
+ @input="onChangeState($event, 'timeout')" />
19
+ <view class="intercept-config-tip">
20
+ {{ t('network.tipsTimeout') }}
21
+ </view>
22
+ <view class="intercept-config-control">
23
+ <DevToolTitle>
24
+ {{ t('network.delay') }}
25
+ </DevToolTitle>
26
+ </view>
27
+ <input
28
+ class="intercept-input"
29
+ :value="state.delay"
30
+ @input="onChangeState($event, 'delay')" />
31
+ <view class="intercept-config-tip">
32
+ {{ t('network.tipsDelay') }}
33
+ </view>
34
+ <view class="intercept-config-control">
35
+ <DevToolTitle>{{ t('network.responseStatus') }}</DevToolTitle>
36
+ </view>
37
+ <input
38
+ class="intercept-input"
39
+ :value="state.status"
40
+ @input="onChangeState($event, 'status')" />
41
+ <view class="intercept-config-control">
42
+ <DevToolTitle>{{ t('network.requestMethod') }}</DevToolTitle>
43
+ </view>
44
+ <radio-group class="radio-group" @change="onChangeRequestMethod">
45
+ <label
46
+ class="radio-group-item"
47
+ v-for="item in requestMethods"
48
+ :key="item.value">
49
+ <radio
50
+ size
51
+ style="transform: scale(0.8)"
52
+ :color="themeColor"
53
+ :value="item.value"
54
+ :checked="item.value === state.method" />
55
+
56
+ <view>{{ item.name }}</view>
57
+ </label>
58
+ </radio-group>
59
+
60
+ <view class="intercept-config-control">
61
+ <DevToolTitle>{{ t('network.requestHeaders') }}</DevToolTitle>
62
+ <CircularButton
63
+ style="margin-left: auto"
64
+ text="+"
65
+ @click="onAddRequestHeader" />
66
+ </view>
67
+
68
+ <view class="intercept-header-list">
69
+ <checkbox-group
70
+ v-if="requestHeaderList.length > 0"
71
+ key="requestHeaderList"
72
+ @change="onChangeRequestHeaderChecked">
73
+ <view
74
+ class="intercept-header-item"
75
+ v-for="(item, index) in requestHeaderList"
76
+ :key="item.id">
77
+ <checkbox
78
+ :color="themeColor"
79
+ :value="item.id"
80
+ :checked="item.checked" />
81
+ <input
82
+ class="intercept-input"
83
+ :placeholder="t('network.placeholderHeaderName')"
84
+ :value="item.key"
85
+ @input="onChangeRequestHeader($event, 'key', index)" />
86
+ <input
87
+ class="intercept-input"
88
+ :placeholder="t('network.placeholderHeaderValue')"
89
+ :value="item.value"
90
+ @input="onChangeRequestHeader($event, 'value', index)" />
91
+ <CircularButton
92
+ style="margin-left: 6px"
93
+ text="一"
94
+ @click="onDeleteRequestHeader(item)" />
95
+ </view>
96
+ </checkbox-group>
97
+
98
+ <view class="intercept-empty" v-else>
99
+ {{ t('network.noRequestHeaders') }}
100
+ </view>
101
+ </view>
102
+
103
+ <view class="intercept-config-control">
104
+ <DevToolTitle>{{ t('network.responseHeaders') }}</DevToolTitle>
105
+ <CircularButton
106
+ style="margin-left: auto"
107
+ text="+"
108
+ @click="onAddResponseHeader" />
109
+ </view>
110
+
111
+ <view class="intercept-header-list">
112
+ <checkbox-group
113
+ v-if="responseHeaderList.length > 0"
114
+ key="responseHeaderList"
115
+ @change="onChangeResponseHeaderChecked">
116
+ <view
117
+ class="intercept-header-item"
118
+ v-for="(item, index) in responseHeaderList"
119
+ :key="item.id">
120
+ <checkbox
121
+ :color="themeColor"
122
+ :value="item.id"
123
+ :checked="item.checked" />
124
+ <input
125
+ class="intercept-input"
126
+ :placeholder="t('network.placeholderRespHeaderName')"
127
+ :value="item.key"
128
+ @input="onChangeResponseHeader($event, 'key', index)" />
129
+ <input
130
+ class="intercept-input"
131
+ :placeholder="t('network.placeholderRespHeaderValue')"
132
+ :value="item.value"
133
+ @input="onChangeResponseHeader($event, 'value', index)" />
134
+ <CircularButton
135
+ style="margin-left: 6px"
136
+ text="一"
137
+ @click="onDeleteResponseHeader(item)" />
138
+ </view>
139
+ </checkbox-group>
140
+
141
+ <view class="intercept-empty" v-else>
142
+ {{ t('network.noResponseHeaders') }}
143
+ </view>
144
+ </view>
145
+ <DevToolTitle>{{ t('network.requestUrl') }}</DevToolTitle>
146
+ <textarea
147
+ :placeholder="t('network.placeholderUrl')"
148
+ class="intercept-textarea"
149
+ :value="state.url"
150
+ @input="onChangeUrl" />
151
+ <view class="form-error-message">
152
+ {{ hasUrl ? '' : t('network.toastEnterUrl') }}
153
+ </view>
154
+
155
+ <view class="intercept-config-control">
156
+ <DevToolTitle>{{ t('network.requestParams') }}</DevToolTitle>
157
+ <CircularButton
158
+ style="margin-left: auto"
159
+ text="+"
160
+ @click="onAddQuery" />
161
+ </view>
162
+ <view class="intercept-param-list">
163
+ <checkbox-group
164
+ v-if="queryList.length > 0"
165
+ @change="handleQueryCheckedChange">
166
+ <view
167
+ class="intercept-param-item"
168
+ v-for="(item, index) in queryList"
169
+ :key="item.id">
170
+ <checkbox
171
+ :color="themeColor"
172
+ :checked="item.checked"
173
+ :value="item.id" />
174
+ <input
175
+ class="intercept-input"
176
+ :placeholder="t('network.placeholderParamName')"
177
+ :value="item.key"
178
+ @input="onChangeQuery($event, 'key', index)" />
179
+ <input
180
+ class="intercept-input"
181
+ :placeholder="t('network.placeholderParamValue')"
182
+ :value="item.value"
183
+ @input="onChangeQuery($event, 'value', index)" />
184
+ <CircularButton
185
+ text="一"
186
+ style="margin-left: 6px"
187
+ @click="onDeleteQuery(item)" />
188
+ </view>
189
+ </checkbox-group>
190
+
191
+ <view class="intercept-empty" v-else>
192
+ {{ t('network.emptyParams') }}
193
+ </view>
194
+ </view>
195
+
196
+ <template v-if="!noBodyRequestMethods.includes(state.method)">
197
+ <view class="intercept-config-control">
198
+ <DevToolTitle>{{ t('network.requestBody') }}</DevToolTitle>
199
+ </view>
200
+
201
+ <textarea
202
+ :placeholder="t('network.placeholderBody')"
203
+ class="intercept-textarea"
204
+ :value="state.bodyText"
205
+ @input="onChangeState($event, 'bodyText')" />
206
+ </template>
207
+
208
+ <view class="intercept-config-control">
209
+ <DevToolTitle>{{ t('network.responseBody') }}</DevToolTitle>
210
+ </view>
211
+ <textarea
212
+ :placeholder="t('network.placeholderRespBody')"
213
+ class="intercept-textarea"
214
+ :value="state.responseText"
215
+ @input="onChangeState($event, 'responseText')" />
216
+ </scroll-view>
217
+ <view class="intercept-config-buttons">
218
+ <SettingButton @click="onConfirm">
219
+ {{ t('network.saveConfig') }}
220
+ </SettingButton>
221
+ </view>
222
+ </view>
223
+ </template>
224
+ <script lang="ts" setup>
225
+ import { computed, ref, onMounted } from 'vue';
226
+ import CircularButton from '../../../components/CircularButton/index.vue';
227
+ import DevToolTitle from '../DevToolTitle/index.vue';
228
+ import type { DevTool } from '../../../../type';
229
+ import SettingButton from '../SettingButton/index.vue';
230
+ import { useI18n } from '../../../../i18n';
231
+ import { getThemeMainColor } from '../../../styles/theme';
232
+ const { t } = useI18n();
233
+
234
+ const themeColor = computed(() => getThemeMainColor(props.theme));
235
+
236
+ const props = defineProps<{
237
+ theme?: string;
238
+ network: DevTool.NetworkItem;
239
+ zIndex?: number;
240
+ customStyle?: Record<string, any>;
241
+ }>();
242
+
243
+ const emit = defineEmits<{
244
+ (e: 'close'): void;
245
+ (e: 'openDetail', v: DevTool.NetworkItem): void;
246
+ (e: 'confirm', v: DevTool.NetworkItem): void;
247
+ }>();
248
+
249
+ import {
250
+ requestMethods,
251
+ noBodyRequestMethods,
252
+ defaultHeader,
253
+ arrayToObject,
254
+ objectToArray,
255
+ arrayToUrlParams,
256
+ urlParamsToObject,
257
+ unionArrayByKey,
258
+ } from './utils';
259
+ import { useKeyValueList, useNetworkState } from './hooks/useNetworkForm';
260
+
261
+ const { state, hasUrl, onChangeState, parseUrlToList, parseListToUrl } =
262
+ useNetworkState({
263
+ method: 'GET',
264
+ url: 'http://mock.view-uni-dev-tool/a?a=123',
265
+ status: 200,
266
+ bodyText: '',
267
+ responseText: '',
268
+ timeout: 3 * 1000,
269
+ delay: 0,
270
+ });
271
+
272
+ const {
273
+ list: requestHeaderList,
274
+ onAdd: onAddRequestHeader,
275
+ onDelete: onDeleteRequestHeader,
276
+ onChangeChecked: onChangeRequestHeaderChecked,
277
+ onChangeValue: onChangeRequestHeaderItem,
278
+ setList: setRequestHeaderList,
279
+ } = useKeyValueList(defaultHeader);
280
+
281
+ const {
282
+ list: responseHeaderList,
283
+ onAdd: onAddResponseHeader,
284
+ onDelete: onDeleteResponseHeader,
285
+ onChangeChecked: onChangeResponseHeaderChecked,
286
+ onChangeValue: onChangeResponseHeaderItem,
287
+ setList: setResponseHeaderList,
288
+ } = useKeyValueList(defaultHeader);
289
+
290
+ const {
291
+ list: queryList,
292
+ onAdd: onAddQuery,
293
+ onDelete: onDeleteQuery,
294
+ onChangeChecked: onChangeQueryChecked,
295
+ onChangeValue: onChangeQueryItem,
296
+ setList: setQueryList,
297
+ } = useKeyValueList([
298
+ {
299
+ id: '1',
300
+ key: 'a',
301
+ value: '123',
302
+ checked: true,
303
+ },
304
+ ]);
305
+
306
+ const isFinished = ref(false);
307
+
308
+ function onChangeUrl(e: any) {
309
+ const url = e.detail.value;
310
+ state.url = url;
311
+ const list = parseUrlToList(url);
312
+ setQueryList(list);
313
+ }
314
+
315
+ function onReset() {
316
+ isFinished.value = false;
317
+ hasUrl.value = true;
318
+ state.method = 'GET';
319
+ state.url = '';
320
+ state.bodyText = '';
321
+ setResponseHeaderList(defaultHeader);
322
+ setQueryList([]);
323
+ }
324
+
325
+ function onClose() {
326
+ emit('close');
327
+ onReset();
328
+ }
329
+
330
+ function onConfirm() {
331
+ if (!state.url) {
332
+ hasUrl.value = false;
333
+ uni.showToast({
334
+ title: t('network.toastEnterUrl'),
335
+ icon: 'none',
336
+ });
337
+ return;
338
+ }
339
+ hasUrl.value = true;
340
+
341
+ const responseHeader = arrayToObject(responseHeaderList);
342
+ const query = arrayToUrlParams(queryList.filter((q) => q.checked));
343
+
344
+ const baseUrl = state.url?.split('?')[0] || '';
345
+ const lastSlashIndex = baseUrl.lastIndexOf('/');
346
+ const name = lastSlashIndex !== -1 ? baseUrl.slice(lastSlashIndex + 1) : '';
347
+
348
+ const interceptConfig: DevTool.NetworkItem = {
349
+ index: 0,
350
+
351
+ name,
352
+ url: state.url,
353
+ method: state.method,
354
+ timeout: state.timeout,
355
+ delay: state.delay,
356
+ status: state.status as string,
357
+ time: '',
358
+ startTime: 0,
359
+ endTime: 0,
360
+ size: '',
361
+ headers: {
362
+ requestHeader: requestHeaderList,
363
+ responseHeader: responseHeaderList,
364
+ },
365
+ response: {
366
+ data: '',
367
+ statusCode: Number(state.status),
368
+ header: responseHeader,
369
+ cookies: [],
370
+ errMsg: 'request:ok',
371
+ },
372
+ payload: {},
373
+ };
374
+
375
+ if (noBodyRequestMethods.includes(state.method)) {
376
+ // 不支持携带 body 参数
377
+
378
+ interceptConfig.payload = {};
379
+ } else {
380
+ // 支持 url 中携带参数
381
+
382
+ if (state.url.includes('?')) {
383
+ interceptConfig.url = state.url + '&' + query;
384
+ } else {
385
+ interceptConfig.url = state.url + '?' + query;
386
+ }
387
+
388
+ // 支持携带 body 参数
389
+ if (state.bodyText?.trim()) {
390
+ try {
391
+ const bodyJson = JSON.parse(state.bodyText);
392
+ interceptConfig.payload = bodyJson;
393
+ } catch (_error) {
394
+ uni.showToast({
395
+ title: t('network.toastBodyJson'),
396
+ icon: 'none',
397
+ });
398
+ return;
399
+ }
400
+ }
401
+ }
402
+
403
+ if (state.responseText?.trim()) {
404
+ try {
405
+ const bodyJson = JSON.parse(state.responseText);
406
+ interceptConfig.response.data = bodyJson;
407
+ } catch (_error) {
408
+ uni.showToast({
409
+ title: t('network.toastRespJson'),
410
+ icon: 'none',
411
+ });
412
+ return;
413
+ }
414
+ }
415
+
416
+ uni.showToast({
417
+ icon: 'none',
418
+ title: t('network.toastSaveSuccess'),
419
+ });
420
+
421
+ emit('confirm', interceptConfig);
422
+ emit('close');
423
+ }
424
+
425
+ function onChangeRequestMethod(e: any) {
426
+ const method = e.detail.value;
427
+ state.method = method;
428
+ }
429
+
430
+ function onChangeRequestHeader(e: any, key: 'key' | 'value', index: number) {
431
+ onChangeRequestHeaderItem(index, key, e.detail.value);
432
+ }
433
+
434
+ function onChangeResponseHeader(e: any, key: 'key' | 'value', index: number) {
435
+ onChangeResponseHeaderItem(index, key, e.detail.value);
436
+ }
437
+
438
+ function handleQueryCheckedChange(e: any) {
439
+ onChangeQueryChecked(e);
440
+ state.url = parseListToUrl(state.url, queryList);
441
+ }
442
+
443
+ function onChangeQuery(e: any, key: 'key' | 'value', index: number) {
444
+ onChangeQueryItem(index, key, e.detail.value);
445
+ state.url = parseListToUrl(state.url, queryList);
446
+ }
447
+
448
+ /**
449
+ * 处理规格
450
+ */
451
+ function handleInterceptConfig() {
452
+ // 如果没有网络数据或尚未开始,则直接返回
453
+ if (!props.network || !props.network.url) return;
454
+
455
+ // 设置基础请求信息
456
+ state.url = props.network.url;
457
+ state.method = props.network.method?.toUpperCase() ?? 'GET';
458
+ state.status = props.network.status as string;
459
+ state.delay = props.network.delay ?? 0;
460
+
461
+ // 初始化请求头
462
+ const requestHeaders =
463
+ props.network.headers?.requestHeader?.map((item, index) => {
464
+ return {
465
+ ...item,
466
+ id: index.toString(),
467
+ checked: true,
468
+ };
469
+ }) ?? [];
470
+
471
+ setRequestHeaderList(requestHeaders);
472
+
473
+ const responseHeaders =
474
+ props.network.headers?.responseHeader?.map((item, index) => {
475
+ return {
476
+ ...item,
477
+ id: index.toString(),
478
+ checked: true,
479
+ };
480
+ }) ?? [];
481
+
482
+ setResponseHeaderList(responseHeaders);
483
+
484
+ setQueryList([]);
485
+
486
+ // 解析参数
487
+ if (noBodyRequestMethods.includes(state.method)) {
488
+ // 参数在 query 中
489
+ if (props.network.url.includes('?')) {
490
+ const urlParams = objectToArray(
491
+ urlParamsToObject(props.network.url.split('?')?.[1] ?? ''),
492
+ );
493
+ const payloadParams = objectToArray(props.network.payload);
494
+
495
+ const list = unionArrayByKey(urlParams, payloadParams, 'key');
496
+
497
+ setQueryList(list);
498
+ }
499
+ } else {
500
+ // 参数在 query 中
501
+ if (props.network.url.includes('?')) {
502
+ const urlParams = objectToArray(
503
+ urlParamsToObject(props.network.url.split('?')?.[1] ?? ''),
504
+ );
505
+ setQueryList(urlParams);
506
+ }
507
+ state.bodyText = JSON.stringify(props.network.payload);
508
+ }
509
+
510
+ if (props.network.response?.data) {
511
+ try {
512
+ state.responseText = JSON.stringify(props.network.response.data);
513
+ } catch (_error) {
514
+ state.responseText = props.network.response.data as string;
515
+ }
516
+ }
517
+ }
518
+
519
+ onMounted(() => {
520
+ handleInterceptConfig();
521
+ });
522
+ </script>
523
+
524
+ <style scoped>
525
+ .intercept-config {
526
+ position: fixed;
527
+ width: 100vw;
528
+ height: 100%;
529
+ z-index: 5;
530
+ top: 0;
531
+ left: 0;
532
+ padding: 0 16px;
533
+
534
+ /* #ifdef H5 || APP-PLUS */
535
+ padding: 50px 16px;
536
+
537
+ /* #endif */
538
+ overflow: auto;
539
+ background-color: var(--dev-tool-bg3-color);
540
+ box-sizing: border-box;
541
+ }
542
+
543
+ .intercept-config-tip {
544
+ font-size: var(--dev-tool-tips-font-size);
545
+ color: var(--dev-tool-info-color);
546
+ }
547
+
548
+ .intercept-config-form {
549
+ height: calc(100% - 32px - 42px);
550
+ overflow: auto;
551
+ }
552
+
553
+ .intercept-config-control {
554
+ display: flex;
555
+ align-items: center;
556
+ gap: 12px;
557
+ height: 32px;
558
+ border-bottom: 1px solid transparent;
559
+ box-sizing: border-box;
560
+ }
561
+
562
+ .radio-group {
563
+ display: flex;
564
+ flex-wrap: wrap;
565
+ }
566
+
567
+ .radio-group-item {
568
+ display: flex;
569
+ align-items: center;
570
+ width: 25%;
571
+ margin-bottom: 6px;
572
+ }
573
+
574
+ .intercept-input {
575
+ padding: 0 6px;
576
+ height: 24px;
577
+ border: 1px solid var(--dev-tool-border-color);
578
+ }
579
+
580
+ .intercept-textarea {
581
+ padding: 6px;
582
+ width: 100%;
583
+ box-sizing: border-box;
584
+ border: 1px solid var(--dev-tool-border-color);
585
+ }
586
+
587
+ .form-error-message {
588
+ padding: 0 6px;
589
+ height: 24px;
590
+ line-height: 24px;
591
+ color: red;
592
+ }
593
+
594
+ .intercept-header-item {
595
+ display: flex;
596
+ align-items: center;
597
+ }
598
+
599
+ .intercept-empty {
600
+ color: var(--dev-tool-info-color);
601
+ text-align: center;
602
+ }
603
+
604
+ .intercept-param-item {
605
+ display: flex;
606
+ align-items: center;
607
+ }
608
+
609
+ .intercept-body-data-item {
610
+ display: flex;
611
+ align-items: center;
612
+ }
613
+
614
+ .intercept-config-buttons {
615
+ position: sticky;
616
+ display: flex;
617
+ justify-content: space-between;
618
+
619
+ /* gap: 6px; */
620
+ width: 100%;
621
+ margin-top: 12px;
622
+ background-color: var(--dev-tool-bg3-color);
623
+ }
624
+ </style>