vite-uni-dev-tool 0.0.13 → 0.0.14

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 (109) hide show
  1. package/dist/v2/AppInfo/index.vue +41 -0
  2. package/dist/v2/AutoSizer/index.vue +189 -0
  3. package/dist/v2/AutoSizer/index1.vue +193 -0
  4. package/dist/v2/AutoSizer/utils.ts +49 -0
  5. package/dist/v2/CaptureScreen/index.vue +78 -0
  6. package/dist/v2/CloseButton/index.vue +32 -0
  7. package/dist/v2/Connection/index.vue +94 -0
  8. package/dist/v2/ConsoleList/ConsoleItem.vue +235 -0
  9. package/dist/v2/ConsoleList/RunJSInput.vue +243 -0
  10. package/dist/v2/ConsoleList/index.vue +164 -0
  11. package/dist/v2/ConsoleList/staticTips.js +1144 -0
  12. package/dist/v2/DevTool/index.vue +162 -0
  13. package/dist/v2/DevToolButton/index.vue +228 -0
  14. package/dist/v2/DevToolTitle/index.vue +28 -0
  15. package/dist/v2/DevToolWindow/index.vue +1051 -0
  16. package/dist/v2/DeviceInfo/index.vue +48 -0
  17. package/dist/v2/Empty/empty.png +0 -0
  18. package/dist/v2/Empty/index.vue +40 -0
  19. package/dist/v2/FilterInput/index.vue +100 -0
  20. package/dist/v2/JsonPretty/components/Brackets/index.vue +30 -0
  21. package/dist/v2/JsonPretty/components/Carets/index.vue +65 -0
  22. package/dist/v2/JsonPretty/components/CheckController/index.vue +127 -0
  23. package/dist/v2/JsonPretty/components/TreeNode/index.vue +417 -0
  24. package/dist/v2/JsonPretty/hooks/useClipboard.ts +21 -0
  25. package/dist/v2/JsonPretty/hooks/useError.ts +21 -0
  26. package/dist/v2/JsonPretty/index.vue +531 -0
  27. package/dist/v2/JsonPretty/type.ts +125 -0
  28. package/dist/v2/JsonPretty/utils/index.js +211 -0
  29. package/dist/v2/NetworkList/NetworkDetail.vue +215 -0
  30. package/dist/v2/NetworkList/NetworkItem.vue +135 -0
  31. package/dist/v2/NetworkList/index.vue +148 -0
  32. package/dist/v2/PiniaList/index.vue +79 -0
  33. package/dist/v2/RouteList/index.vue +137 -0
  34. package/dist/v2/RunJS/index.vue +128 -0
  35. package/dist/v2/SettingList/index.vue +318 -0
  36. package/dist/v2/SourceCode/index.vue +237 -0
  37. package/dist/v2/StorageList/index.vue +165 -0
  38. package/dist/v2/SystemInfo/index.vue +49 -0
  39. package/dist/v2/Tabs/index.vue +127 -0
  40. package/dist/v2/Tag/index.vue +91 -0
  41. package/dist/v2/UniEvent/UniEventItem.vue +157 -0
  42. package/dist/v2/UniEvent/index.vue +127 -0
  43. package/dist/v2/UploadList/UploadDetail.vue +204 -0
  44. package/dist/v2/UploadList/UploadItem.vue +134 -0
  45. package/dist/v2/UploadList/index.vue +143 -0
  46. package/dist/v2/VirtualList/index.vue +140 -0
  47. package/dist/v2/VirtualListPro/AutoSize.vue +50 -0
  48. package/dist/v2/VirtualListPro/index.vue +255 -0
  49. package/dist/v2/VirtualListPro/readme.md +40 -0
  50. package/dist/v2/VuexList/index.vue +80 -0
  51. package/dist/v2/WebSocket/WebSocketItem.vue +129 -0
  52. package/dist/v2/WebSocket/WebSocketList.vue +183 -0
  53. package/dist/v2/WebSocket/index.vue +155 -0
  54. package/dist/v2/WindowInfo/index.vue +49 -0
  55. package/dist/v3/AppInfo/index.vue +35 -0
  56. package/dist/v3/AutoSizer/index.vue +193 -0
  57. package/dist/v3/AutoSizer/index1.vue +186 -0
  58. package/dist/v3/AutoSizer/utils.ts +49 -0
  59. package/dist/v3/CaptureScreen/index.vue +62 -0
  60. package/dist/v3/CloseButton/index.vue +29 -0
  61. package/dist/v3/Connection/index.vue +88 -0
  62. package/dist/v3/ConsoleList/ConsoleItem.vue +208 -0
  63. package/dist/v3/ConsoleList/RunJSInput.vue +240 -0
  64. package/dist/v3/ConsoleList/index.vue +139 -0
  65. package/dist/v3/ConsoleList/staticTips.ts +1145 -0
  66. package/dist/v3/DevTool/index.vue +217 -0
  67. package/dist/v3/DevToolButton/index.vue +210 -0
  68. package/dist/v3/DevToolTitle/index.vue +21 -0
  69. package/dist/v3/DevToolWindow/index.vue +1116 -0
  70. package/dist/v3/DeviceInfo/index.vue +32 -0
  71. package/dist/v3/Empty/empty.png +0 -0
  72. package/dist/v3/Empty/index.vue +28 -0
  73. package/dist/v3/FilterInput/index.vue +87 -0
  74. package/dist/v3/JsonPretty/components/Brackets/index.vue +23 -0
  75. package/dist/v3/JsonPretty/components/Carets/index.vue +59 -0
  76. package/dist/v3/JsonPretty/components/CheckController/index.vue +125 -0
  77. package/dist/v3/JsonPretty/components/TreeNode/index.vue +349 -0
  78. package/dist/v3/JsonPretty/hooks/useClipboard.ts +21 -0
  79. package/dist/v3/JsonPretty/hooks/useError.ts +21 -0
  80. package/dist/v3/JsonPretty/index.vue +476 -0
  81. package/dist/v3/JsonPretty/type.ts +125 -0
  82. package/dist/v3/JsonPretty/utils/index.ts +172 -0
  83. package/dist/v3/NetworkList/NetworkDetail.vue +194 -0
  84. package/dist/v3/NetworkList/NetworkItem.vue +120 -0
  85. package/dist/v3/NetworkList/index.vue +128 -0
  86. package/dist/v3/PiniaList/index.vue +64 -0
  87. package/dist/v3/RouteList/index.vue +121 -0
  88. package/dist/v3/RunJS/index.vue +128 -0
  89. package/dist/v3/SettingList/index.vue +313 -0
  90. package/dist/v3/SourceCode/index.vue +231 -0
  91. package/dist/v3/StorageList/index.vue +170 -0
  92. package/dist/v3/SystemInfo/index.vue +34 -0
  93. package/dist/v3/Tabs/index.vue +123 -0
  94. package/dist/v3/Tag/index.vue +89 -0
  95. package/dist/v3/UniEvent/UniEventItem.vue +126 -0
  96. package/dist/v3/UniEvent/index.vue +98 -0
  97. package/dist/v3/UploadList/UploadDetail.vue +192 -0
  98. package/dist/v3/UploadList/UploadItem.vue +117 -0
  99. package/dist/v3/UploadList/index.vue +117 -0
  100. package/dist/v3/VirtualList/index.vue +112 -0
  101. package/dist/v3/VirtualListPro/AutoSize.vue +43 -0
  102. package/dist/v3/VirtualListPro/index.vue +238 -0
  103. package/dist/v3/VirtualListPro/readme.md +40 -0
  104. package/dist/v3/VuexList/index.vue +54 -0
  105. package/dist/v3/WebSocket/WebSocketItem.vue +103 -0
  106. package/dist/v3/WebSocket/WebSocketList.vue +161 -0
  107. package/dist/v3/WebSocket/index.vue +124 -0
  108. package/dist/v3/WindowInfo/index.vue +33 -0
  109. package/package.json +1 -1
@@ -0,0 +1,211 @@
1
+ /**
2
+ *
3
+ *
4
+ * @export
5
+ * @param {string} message
6
+ */
7
+ export function emitError(message) {
8
+ throw new Error(`[JsonPretty] ${message}`);
9
+ }
10
+
11
+ /**
12
+ *
13
+ *
14
+ * @export
15
+ * @param {any} value
16
+ * @return {*} {string}
17
+ */
18
+ export function getDataType(value) {
19
+ return Object.prototype.toString.call(value).slice(8, -1).toLowerCase();
20
+ }
21
+
22
+ /**
23
+ *
24
+ *
25
+ * @export
26
+ * @param {JSONDataType} data
27
+ * @param {string} [path="root"]
28
+ * @param {number} [level=0]
29
+ * @param {JSONFlattenOptions} [options]
30
+ * @return {*} {JSONFlattenReturnType[]}
31
+ */
32
+ export function jsonFlatten(data, path = 'root', level = 0, options) {
33
+ const {
34
+ key,
35
+ index,
36
+ type = 'content',
37
+ showComma = false,
38
+ length = 1,
39
+ } = options || {};
40
+ const dataType = getDataType(data);
41
+
42
+ if (dataType === 'array') {
43
+ const inner = arrFlat(
44
+ data.map((item, idx, arr) =>
45
+ jsonFlatten(item, `${path}[${idx}]`, level + 1, {
46
+ index: idx,
47
+ showComma: idx !== arr.length - 1,
48
+ length,
49
+ type,
50
+ }),
51
+ ),
52
+ );
53
+ return [
54
+ jsonFlatten('[', path, level, {
55
+ showComma: false,
56
+ key,
57
+ length: data.length,
58
+ type: 'arrayStart',
59
+ })[0],
60
+ ].concat(
61
+ inner,
62
+ jsonFlatten(']', path, level, {
63
+ showComma,
64
+ length: data.length,
65
+ type: 'arrayEnd',
66
+ })[0],
67
+ );
68
+ } else if (dataType === 'object') {
69
+ const keys = Object.keys(data);
70
+ const inner = arrFlat(
71
+ keys.map((objKey, idx, arr) =>
72
+ jsonFlatten(
73
+ data[objKey],
74
+ /^[a-zA-Z_]\w*$/.test(objKey)
75
+ ? `${path}.${objKey}`
76
+ : `${path}["${objKey}"]`,
77
+ level + 1,
78
+ {
79
+ key: objKey,
80
+ showComma: idx !== arr.length - 1,
81
+ length,
82
+ type,
83
+ },
84
+ ),
85
+ ),
86
+ );
87
+ return [
88
+ jsonFlatten('{', path, level, {
89
+ showComma: false,
90
+ key,
91
+ index,
92
+ length: keys.length,
93
+ type: 'objectStart',
94
+ })[0],
95
+ ].concat(
96
+ inner,
97
+ jsonFlatten('}', path, level, {
98
+ showComma,
99
+ length: keys.length,
100
+ type: 'objectEnd',
101
+ })[0],
102
+ );
103
+ }
104
+
105
+ return [
106
+ {
107
+ content: data,
108
+ level,
109
+ key,
110
+ index,
111
+ path,
112
+ showComma,
113
+ length,
114
+ type,
115
+ },
116
+ ];
117
+ }
118
+
119
+ /**
120
+ *
121
+ *
122
+ * @export
123
+ * @template T
124
+ * @param {T} arr
125
+ * @return {*} {unknown[]}
126
+ */
127
+ export function arrFlat(arr) {
128
+ if (typeof Array.prototype.flat === 'function') {
129
+ return arr.flat();
130
+ }
131
+ const stack = [...arr];
132
+ const result = [];
133
+ while (stack.length) {
134
+ const first = stack.shift();
135
+ if (Array.isArray(first)) {
136
+ stack.unshift(...first);
137
+ } else {
138
+ result.push(first);
139
+ }
140
+ }
141
+ return result;
142
+ }
143
+
144
+ /**
145
+ *
146
+ *
147
+ * @export
148
+ * @template T
149
+ * @param {T} source
150
+ * @param {*} [hash=new WeakMap()]
151
+ * @return {*} {T}
152
+ */
153
+ export function cloneDeep(source, hash = new WeakMap()) {
154
+ if (source === null || source === undefined) return source;
155
+ if (source instanceof Date) return new Date(source);
156
+ if (source instanceof RegExp) return new RegExp(source);
157
+ if (typeof source !== 'object') return source;
158
+ if (hash.get(source)) return hash.get(source);
159
+
160
+ if (Array.isArray(source)) {
161
+ const output = source.map((item) => cloneDeep(item, hash));
162
+ hash.set(source, output);
163
+ return output;
164
+ }
165
+ const output = {};
166
+ for (const key in source) {
167
+ output[key] = cloneDeep(source[key], hash);
168
+ }
169
+ hash.set(source, output);
170
+ return output;
171
+ }
172
+
173
+ /**
174
+ *
175
+ *
176
+ * @export
177
+ * @param {string} source
178
+ * @return {*} {unknown}
179
+ */
180
+ export function stringToAutoType(source) {
181
+ let value;
182
+ if (source === 'null') value = null;
183
+ else if (source === 'undefined') value = undefined;
184
+ else if (source === 'true') value = true;
185
+ else if (source === 'false') value = false;
186
+ else if (
187
+ source[0] + source[source.length - 1] === '""' ||
188
+ source[0] + source[source.length - 1] === "''"
189
+ ) {
190
+ value = source.slice(1, -1);
191
+ } else if (
192
+ (typeof Number(source) === 'number' && !isNaN(Number(source))) ||
193
+ source === 'NaN'
194
+ ) {
195
+ value = Number(source);
196
+ } else {
197
+ value = source;
198
+ }
199
+ return value;
200
+ }
201
+
202
+ /**
203
+ *
204
+ *
205
+ * @export
206
+ * @param {unknown} value
207
+ * @return {boolean} {boolean}
208
+ */
209
+ export function isFunction(value) {
210
+ return typeof value === 'function';
211
+ }
@@ -0,0 +1,215 @@
1
+ <template>
2
+ <view class="network-detail" :style="{ zIndex: zIndex }">
3
+ <view class="network-detail-control">
4
+ <Tag
5
+ mode="info"
6
+ v-for="item in selectItems"
7
+ :active="item.value === currentSelect"
8
+ :key="item.value"
9
+ @click="onSelect(item)"
10
+ >
11
+ {{ item.label }}
12
+ </Tag>
13
+ <CloseButton style="margin-left: auto" @click="onClose" />
14
+ </view>
15
+
16
+ <view class="network-detail-header" v-if="currentSelect === 'header'">
17
+ <view class="network-detail-title">常规</view>
18
+ <view class="net-detail-item">
19
+ <view>请求url:</view>
20
+ <view>{{ network.url }}</view>
21
+ </view>
22
+ <view class="net-detail-item">
23
+ <view>请求方法:</view>
24
+ <Tag mode="info">{{ network.method }}</Tag>
25
+ </view>
26
+ <view class="net-detail-item">
27
+ <view>状态代码:</view>
28
+ {{ network.status }}
29
+ </view>
30
+ <view class="network-detail-title">请求头</view>
31
+ <view
32
+ class="net-detail-item"
33
+ v-for="item in network.headers.requestHeader"
34
+ :key="item.key"
35
+ >
36
+ <view>{{ item.key }}:</view>
37
+ {{ item.value }}
38
+ </view>
39
+ <view class="network-detail-title">响应头</view>
40
+ <view
41
+ class="net-detail-item"
42
+ v-for="item in network.headers.responseHeader"
43
+ :key="item.key"
44
+ >
45
+ <view>{{ item.key }}:</view>
46
+ {{ item.value }}
47
+ </view>
48
+ </view>
49
+
50
+ <template v-if="currentSelect === 'payload'">
51
+ <template v-if="payload.type === 'object'">
52
+ <JsonPretty :data="payload.value" />
53
+ </template>
54
+ <view
55
+ v-else-if="payload.type === 'string'"
56
+ class="network-detail-payload"
57
+ >
58
+ {{ payload.value }}
59
+ </view>
60
+ <Empty v-else />
61
+ </template>
62
+
63
+ <template v-if="currentSelect === 'response'">
64
+ <template v-if="response.type === 'object'">
65
+ <JsonPretty :data="response.value" virtual />
66
+ </template>
67
+ <view
68
+ v-else-if="response.type === 'string'"
69
+ class="network-detail-payload"
70
+ >
71
+ {{ response.value }}
72
+ </view>
73
+ <Empty v-else />
74
+ </template>
75
+ </view>
76
+ </template>
77
+
78
+ <script>
79
+ import JsonPretty from '../JsonPretty/index.vue';
80
+ import Tag from '../Tag/index.vue';
81
+ import Empty from '../Empty/index.vue';
82
+ import CloseButton from '../CloseButton/index.vue';
83
+
84
+ export default {
85
+ components: {
86
+ JsonPretty,
87
+ Tag,
88
+ Empty,
89
+ CloseButton,
90
+ },
91
+ props: {
92
+ network: {
93
+ type: Object,
94
+ required: true,
95
+ },
96
+ zIndex: {
97
+ type: Number,
98
+ default: 0,
99
+ },
100
+ },
101
+ data() {
102
+ return {
103
+ selectItems: [
104
+ {
105
+ label: 'header',
106
+ value: 'header',
107
+ },
108
+ {
109
+ label: 'payload',
110
+ value: 'payload',
111
+ },
112
+ {
113
+ label: 'response',
114
+ value: 'response',
115
+ },
116
+ ],
117
+ currentSelect: 'header',
118
+ };
119
+ },
120
+ computed: {
121
+ payload() {
122
+ try {
123
+ if (this.network.payload) {
124
+ return {
125
+ value: JSON.parse(this.network.payload),
126
+ type: 'object',
127
+ };
128
+ }
129
+ return {
130
+ value: {},
131
+ type: 'empty',
132
+ };
133
+ } catch (error) {
134
+ return {
135
+ value: this.network.payload,
136
+ type: this.network.payload ? 'string' : 'empty',
137
+ };
138
+ }
139
+ },
140
+ response() {
141
+ try {
142
+ if (this.network.response) {
143
+ return {
144
+ value: JSON.parse(JSON.stringify(this.network.response)),
145
+ type: 'object',
146
+ };
147
+ }
148
+ return {
149
+ value: {},
150
+ type: 'empty',
151
+ };
152
+ } catch (error) {
153
+ return {
154
+ value: this.network.response,
155
+ type: this.network.response ? 'string' : 'empty',
156
+ };
157
+ }
158
+ },
159
+ },
160
+ methods: {
161
+ onSelect(item) {
162
+ this.currentSelect = item.value;
163
+ },
164
+ onClose() {
165
+ this.$emit('close');
166
+ },
167
+ },
168
+ };
169
+ </script>
170
+ <style scoped>
171
+ .network-detail {
172
+ position: fixed;
173
+ width: 100vw;
174
+ height: 100vh;
175
+ z-index: 1001;
176
+ top: 0;
177
+ left: 0;
178
+ padding: 0 16px;
179
+
180
+ background-color: var(--dev-tool-bg-color);
181
+ box-sizing: border-box;
182
+ }
183
+ .network-detail .network-detail-control {
184
+ display: flex;
185
+ align-items: center;
186
+ margin-bottom: 4px;
187
+ gap: 12px;
188
+ height: 32px;
189
+ border-bottom: 1px solid transparent;
190
+ box-sizing: border-box;
191
+ }
192
+
193
+ .network-detail .network-detail-control :deep(.tag) {
194
+ margin-right: 16px;
195
+ }
196
+ .network-detail .network-detail-control :deep(.tag):last-child {
197
+ margin-right: 0;
198
+ }
199
+
200
+ .network-detail .network-detail-header .net-detail-item {
201
+ display: flex;
202
+ align-items: center;
203
+ min-height: 28px;
204
+ word-break: break-all;
205
+ }
206
+ .network-detail .network-detail-header .net-detail-item > view:first-child {
207
+ white-space: nowrap;
208
+ margin-right: 8px;
209
+ color: var(--dev-tool-info-color);
210
+ }
211
+ .network-detail .network-detail-payload {
212
+ word-break: break-all;
213
+ max-width: 100%;
214
+ }
215
+ </style>
@@ -0,0 +1,135 @@
1
+ <template>
2
+ <view class="network-item">
3
+ <view class="network-url-row">
4
+ <Tag mode="info">{{ network.method }}</Tag>
5
+
6
+ <view class="network-url" v-html="lastUrl"> </view>
7
+
8
+ <Tag
9
+ mode="main"
10
+ class="network-detail-icon"
11
+ @click="showDetail = !showDetail"
12
+ >详情</Tag
13
+ >
14
+ </view>
15
+ <view class="network-info">
16
+ <view>
17
+ <Tag
18
+ :mode="
19
+ network.status === 'pending'
20
+ ? 'info'
21
+ : /[4,5]\d{2,}/.test(network.status + '') ||
22
+ network.status === 'error'
23
+ ? 'error'
24
+ : 'success'
25
+ "
26
+ >{{ network.status }}</Tag
27
+ >
28
+ </view>
29
+ <view>{{ network.time }}</view>
30
+ <view>{{ network.size }}</view>
31
+ <view
32
+ >开始:
33
+ {{
34
+ network.startTime
35
+ ? formatDate(network.startTime, 'HH:mm:ss')
36
+ : '--:--:--'
37
+ }}</view
38
+ >
39
+ <view>
40
+ 结束:
41
+ {{
42
+ network.endTime ? formatDate(network.endTime, 'HH:mm:ss') : '--:--:--'
43
+ }}
44
+ </view>
45
+ </view>
46
+ </view>
47
+ <NetworkDetail
48
+ v-if="showDetail"
49
+ :network="network"
50
+ :zIndex="zIndex"
51
+ @close="onClose"
52
+ />
53
+ </template>
54
+
55
+ <script>
56
+ import Tag from '../Tag/index.vue';
57
+ import NetworkDetail from './NetworkDetail.vue';
58
+ import { formatDate } from '../../utils';
59
+
60
+ export default {
61
+ components: {
62
+ Tag,
63
+ NetworkDetail,
64
+ },
65
+ props: {
66
+ network: {
67
+ type: Object,
68
+ required: true,
69
+ },
70
+ zIndex: {
71
+ type: Number,
72
+ default: 0,
73
+ },
74
+ },
75
+ data() {
76
+ return {
77
+ showDetail: false,
78
+ };
79
+ },
80
+ computed: {
81
+ lastUrl() {
82
+ const start = this.network.url.lastIndexOf('/');
83
+ return this.network.url.slice(start + 1);
84
+ },
85
+ },
86
+ methods: {
87
+ onClose() {
88
+ this.showDetail = false;
89
+ },
90
+ formatDate,
91
+ },
92
+ };
93
+ </script>
94
+ <style scoped>
95
+ .network-item {
96
+ padding: 16px;
97
+ border-bottom: 1px solid var(--dev-tool-border-color);
98
+ font-size: var(--dev-tool-base-font-size);
99
+ }
100
+ .network-url-row {
101
+ display: flex;
102
+ align-items: center;
103
+ }
104
+
105
+ .network-url {
106
+ margin-left: 4px;
107
+ flex: 1;
108
+ white-space: nowrap;
109
+ overflow: hidden;
110
+ text-overflow: ellipsis;
111
+ }
112
+ .network-detail-icon {
113
+ margin-left: auto;
114
+ }
115
+
116
+ .network-info {
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: space-between;
120
+ margin-top: 4px;
121
+ color: var(--dev-tool-text-color);
122
+ transition: color 0.3s;
123
+ }
124
+ .slide-fade-enter-active {
125
+ transition: all 0.8s ease-out;
126
+ }
127
+ .slide-fade-leave-active {
128
+ transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
129
+ }
130
+ .slide-fade-enter-from,
131
+ .slide-fade-leave-to {
132
+ transform: translateY(20px);
133
+ opacity: 0;
134
+ }
135
+ </style>
@@ -0,0 +1,148 @@
1
+ <template>
2
+ <view class="network-content">
3
+ <view class="network-control">
4
+ <FilterInput
5
+ :modelValue="modelValue"
6
+ placeholder="查询url"
7
+ @search="$emit('search', $event)"
8
+ @update:modelValue="$emit('update:modelValue', $event)"
9
+ />
10
+ <Tag
11
+ v-for="item in networkFilterItems"
12
+ :mode="item.mode"
13
+ :key="item.value"
14
+ :active="item.value === currentNetworkType"
15
+ @click="onChoose(item.value)"
16
+ >
17
+ {{ item.label }}
18
+ </Tag>
19
+ </view>
20
+
21
+ <VirtualListPro
22
+ :dataSource="networkList"
23
+ :pageSize="15"
24
+ :height="height"
25
+ className="network-list"
26
+ >
27
+ <template v-slot="{ list, start }">
28
+ <AutoSize
29
+ v-for="(item, index) in list"
30
+ :index="start + index"
31
+ :key="start + index"
32
+ >
33
+ <NetworkItem :network="item" :zIndex="zIndex" />
34
+ </AutoSize>
35
+ <Empty v-if="!networkList || networkList.length === 0" />
36
+ </template>
37
+ </VirtualListPro>
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import Tag from '../Tag/index.vue';
43
+ import NetworkItem from './NetworkItem.vue';
44
+ import Empty from '../Empty/index.vue';
45
+ import FilterInput from '../FilterInput/index.vue';
46
+ import VirtualListPro from '../VirtualListPro/index.vue';
47
+ import AutoSize from '../VirtualListPro/AutoSize.vue';
48
+
49
+ export default {
50
+ components: {
51
+ Tag,
52
+ NetworkItem,
53
+ Empty,
54
+ FilterInput,
55
+ VirtualListPro,
56
+ AutoSize
57
+ },
58
+ props: {
59
+ currentNetworkType: {
60
+ type: String,
61
+ required: true
62
+ },
63
+ networkList: {
64
+ type: Array,
65
+ default: () => []
66
+ },
67
+ modelValue: {
68
+ type: String,
69
+ default: ''
70
+ },
71
+ zIndex: {
72
+ type: Number,
73
+ default: 0
74
+ }
75
+ },
76
+ data() {
77
+ return {
78
+ networkFilterItems: [
79
+ {
80
+ label: '全部',
81
+ value: 'all',
82
+ mode: 'all'
83
+ },
84
+ {
85
+ label: 'get',
86
+ value: 'GET',
87
+ mode: 'info'
88
+ },
89
+ {
90
+ label: 'post',
91
+ value: 'POST',
92
+ mode: 'info'
93
+ },
94
+ {
95
+ label: 'put',
96
+ value: 'PUT',
97
+ mode: 'info'
98
+ },
99
+ {
100
+ label: 'del',
101
+ value: 'DELETE',
102
+ mode: 'info'
103
+ },
104
+ {
105
+ label: 'error',
106
+ value: 'error',
107
+ mode: 'error'
108
+ },
109
+ {
110
+ label: '清除',
111
+ value: 'clear',
112
+ mode: 'clear'
113
+ }
114
+ ],
115
+ height: 0
116
+ };
117
+ },
118
+ mounted() {
119
+ const { windowHeight } = uni.getWindowInfo();
120
+ this.height = windowHeight - 32 - 32;
121
+ },
122
+ methods: {
123
+ onChoose(type) {
124
+ this.$emit('choose', type);
125
+ }
126
+ }
127
+ };
128
+ </script>
129
+
130
+ <style scoped>
131
+ .network-content {
132
+ height: 100%;
133
+ font-size: var(--dev-tool-base-font-size);
134
+ }
135
+ .network-list {
136
+ height: calc(100% - 32px);
137
+ }
138
+ .network-control {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: space-between;
142
+ gap: 8px;
143
+ padding: 0 16px;
144
+ height: 32px;
145
+ border-bottom: 1px solid var(--dev-tool-border-color);
146
+ box-sizing: border-box;
147
+ }
148
+ </style>