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,126 @@
1
+ <template>
2
+ <view class="uni-event-item">
3
+ <view class="uni-event-item-row"> {{ eventItem.eventName }} </view>
4
+ <view class="uni-event-item-row">
5
+ <Tag mode="info" v-if="eventItem.type == 'on'">
6
+ {{ eventItem.type }}
7
+ </Tag>
8
+ <Tag mode="warn" v-if="eventItem.type == 'once'">
9
+ {{ eventItem.type }}
10
+ </Tag>
11
+ <Tag mode="main" v-if="eventItem.type == 'emit'">
12
+ {{ eventItem.type }}
13
+ </Tag>
14
+ <Tag mode="error" v-if="eventItem.type == 'off'">
15
+ {{ eventItem.type }}
16
+ </Tag>
17
+ <view class="uni-event-item-right"> {{ eventItem.timer }}</view>
18
+ </view>
19
+
20
+ <view
21
+ :class="`uni-event-item-right ${isUseDevSource ? 'link' : ''}`"
22
+ @click="onStackClick"
23
+ >
24
+ {{ eventItem.stack }}
25
+ </view>
26
+
27
+ <SourceCode
28
+ v-if="openCode && eventItem.stack"
29
+ :url="eventItem.stack"
30
+ :sourceFileServers="sourceFileServers"
31
+ :mode="mode"
32
+ :zIndex="zIndex"
33
+ @close="onCloseCode"
34
+ />
35
+ </view>
36
+ </template>
37
+ <script lang="ts" setup>
38
+ import Tag from '../Tag/index.vue';
39
+ import SourceCode from '../SourceCode/index.vue';
40
+ import type { DevTool } from '../../type';
41
+ import { computed, ref } from 'vue';
42
+ import { isAndroid, isMockWX } from '../../utils';
43
+
44
+ const props = defineProps<{
45
+ eventItem: DevTool.EventItem;
46
+ mode?: string;
47
+ useDevSource?: boolean;
48
+ sourceFileServers?: string[];
49
+ zIndex?: number;
50
+ }>();
51
+
52
+ const openCode = ref(false);
53
+
54
+ const isUseDevSource = computed(() => {
55
+ return (
56
+ !isMockWX(props?.eventItem?.stack ?? '') &&
57
+ props.mode === 'development' &&
58
+ props.useDevSource
59
+ );
60
+ });
61
+
62
+ const isWXLink = computed(() => {
63
+ console.log('props?.eventItem: ', props?.eventItem);
64
+ console.log('props.mode: ', props.mode);
65
+ return (
66
+ isMockWX(props?.eventItem?.stack ?? '') || props.mode !== 'development'
67
+ );
68
+ });
69
+
70
+ function onStackClick() {
71
+ if (isWXLink.value) {
72
+ uni.showToast({
73
+ icon: 'none',
74
+ title: '[DevTool] 请在小程序真机调试模式下查看源码',
75
+ });
76
+ return;
77
+ }
78
+
79
+ if (!isUseDevSource.value) {
80
+ return;
81
+ }
82
+
83
+ if (isAndroid()) {
84
+ if (props.sourceFileServers && props.sourceFileServers.length > 0) {
85
+ openCode.value = true;
86
+ } else {
87
+ uni.showToast({
88
+ icon: 'none',
89
+ title: '[DevTool] sourceFileServers 配置异常',
90
+ });
91
+ uni?.__dev__console?.log('[DevTool] sourceFileServers 配置异常');
92
+ }
93
+ } else {
94
+ openCode.value = true;
95
+ }
96
+ }
97
+
98
+ function onCloseCode() {
99
+ openCode.value = false;
100
+ }
101
+ </script>
102
+
103
+ <style scoped>
104
+ .uni-event-item {
105
+ padding: 16px;
106
+ border-bottom: 1px solid var(--dev-tool-border-color);
107
+ box-sizing: border-box;
108
+ }
109
+
110
+ .uni-event-item-row {
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: space-between;
114
+ height: 28px;
115
+ word-break: break-all;
116
+ }
117
+
118
+ .uni-event-item-right {
119
+ text-align: right;
120
+ word-break: break-all;
121
+ }
122
+ .link {
123
+ cursor: pointer;
124
+ text-decoration: underline;
125
+ }
126
+ </style>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <view class="uni-event-content">
3
+ <DevToolTitle innerStyle="padding: 0 16px">事件触发统计</DevToolTitle>
4
+ <view class="uni-event-statistics">
5
+ <view class="uni-event-statistics-item">
6
+ <view>on: </view>
7
+ <Tag mode="log" style="flex: 1; justify-content: center">
8
+ {{ eventCount?.on ?? 0 }}
9
+ </Tag>
10
+ </view>
11
+ <view class="uni-event-statistics-item">
12
+ <view>once: </view>
13
+ <Tag mode="warn" style="flex: 1; justify-content: center">
14
+ {{ eventCount?.once ?? 0 }}
15
+ </Tag>
16
+ </view>
17
+ <view class="uni-event-statistics-item">
18
+ <view>emit: </view>
19
+ <Tag mode="main" style="flex: 1; justify-content: center">
20
+ {{ eventCount?.emit ?? 0 }}
21
+ </Tag>
22
+ </view>
23
+ <view class="uni-event-statistics-item">
24
+ <view>off: </view>
25
+ <Tag mode="error" style="flex: 1; justify-content: center">
26
+ {{ eventCount?.off ?? 0 }}
27
+ </Tag>
28
+ </view>
29
+ </view>
30
+ <DevToolTitle innerStyle="padding: 0 16px">
31
+ 事件触发列表
32
+
33
+ <Tag mode="clear" style="margin-left: auto" @click="emit('clear')">
34
+ 清空
35
+ </Tag>
36
+ </DevToolTitle>
37
+ <view class="uni-event-list">
38
+ <UniEventItem
39
+ v-for="item in eventList"
40
+ :eventItem="item"
41
+ :mode="mode"
42
+ :useDevSource="useDevSource"
43
+ :sourceFileServers="sourceFileServers"
44
+ :zIndex="zIndex"
45
+ />
46
+ <Empty v-if="!eventList || eventList.length === 0"> </Empty>
47
+ </view>
48
+ </view>
49
+ </template>
50
+ <script lang="ts" setup>
51
+ import DevToolTitle from '../DevToolTitle/index.vue';
52
+ import UniEventItem from './UniEventItem.vue';
53
+ import Tag from '../Tag/index.vue';
54
+ import Empty from '../Empty/index.vue';
55
+ import type { DevTool } from '@/dev/type';
56
+
57
+ defineProps<{
58
+ eventList?: DevTool.EventItem[];
59
+ eventCount?: DevTool.EventCount;
60
+ useDevSource?: boolean;
61
+ mode?: string;
62
+ sourceFileServers?: string[];
63
+ zIndex?: number;
64
+ }>();
65
+
66
+ const emit = defineEmits<{
67
+ (e: 'clear'): void;
68
+ }>();
69
+ </script>
70
+ <style scoped>
71
+ .uni-event-content {
72
+ height: 100%;
73
+ overflow: auto;
74
+ font-size: var(--dev-tool-base-font-size);
75
+ }
76
+
77
+ .uni-event-statistics {
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: space-around;
81
+ padding: 0 16px;
82
+ height: 32px;
83
+ box-sizing: border-box;
84
+ gap: 12px;
85
+ }
86
+ .uni-event-statistics-item {
87
+ display: flex;
88
+ align-items: center;
89
+ width: 25%;
90
+ }
91
+ .uni-event-statistics-item view:first-child {
92
+ margin-right: 8px;
93
+ }
94
+ .uni-event-list {
95
+ height: calc(100% - 32px * 3);
96
+ overflow: auto;
97
+ }
98
+ </style>
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <view class="upload-detail" :style="{ zIndex: zIndex }">
3
+ <view class="upload-detail-control">
4
+ <Tag
5
+ v-for="item in selectItems"
6
+ :active="currentSelect === item.value"
7
+ :mode="item.mode"
8
+ :key="item.value"
9
+ @click="onSelect(item)"
10
+ >
11
+ {{ item.label }}
12
+ </Tag>
13
+
14
+ <CloseButton style="margin-left: auto" @click="onClose" />
15
+ </view>
16
+
17
+ <view class="upload-detail-header" v-if="currentSelect === 'header'">
18
+ <view class="upload-detail-title">常规</view>
19
+ <view class="net-detail-item">
20
+ <view>请求url:</view>
21
+ <view>{{ upload.url }}</view>
22
+ </view>
23
+ <view class="net-detail-item">
24
+ <view>请求方法:</view>
25
+ <Tag mode="info">{{ upload.method ?? 'POST' }}</Tag>
26
+ </view>
27
+ <view class="net-detail-item">
28
+ <view>状态代码:</view>
29
+ <Tag mode="info">{{ upload.status }}</Tag>
30
+ </view>
31
+ <view class="upload-detail-title">请求头</view>
32
+ <view
33
+ class="net-detail-item"
34
+ v-for="item in upload?.headers?.requestHeader"
35
+ :key="item.key"
36
+ >
37
+ <view>{{ item.key }}:</view>
38
+ {{ item.value }}
39
+ </view>
40
+ <!-- <view class="upload-detail-title">响应头</view>
41
+ <view
42
+ class="net-detail-item"
43
+ v-for="item in upload?.headers?.responseHeader"
44
+ :key="item.key"
45
+ >
46
+ <view>{{ item.key }}:</view>
47
+ {{ item.value }}
48
+ </view> -->
49
+ </view>
50
+
51
+ <template v-if="currentSelect === 'formdata'">
52
+ <template v-if="formData?.type === 'object'">
53
+ <JsonPretty :data="formData.value" />
54
+ </template>
55
+ <view
56
+ v-else-if="formData?.type === 'string'"
57
+ class="upload-detail-payload"
58
+ >
59
+ {{ formData.value }}
60
+ </view>
61
+ <Empty v-else />
62
+ </template>
63
+
64
+ <template v-if="currentSelect === 'response'">
65
+ <template v-if="response?.type === 'object'">
66
+ <JsonPretty :data="response.value" virtual />
67
+ </template>
68
+ <view
69
+ v-else-if="response?.type === 'string'"
70
+ class="upload-detail-payload"
71
+ >
72
+ {{ response.value }}
73
+ </view>
74
+ <Empty v-else />
75
+ </template>
76
+ </view>
77
+ </template>
78
+ <script lang="ts" setup>
79
+ import { ref, computed } from 'vue';
80
+ import JsonPretty from '../JsonPretty/index.vue';
81
+ import Tag from '../Tag/index.vue';
82
+ import Empty from '../Empty/index.vue';
83
+ import CloseButton from '../CloseButton/index.vue';
84
+ import type { DevTool } from '../../type';
85
+ const props = defineProps<{ upload: DevTool.UploadItem; zIndex?: number }>();
86
+ const emit = defineEmits<{ (e: 'close'): void }>();
87
+ const selectItems = [
88
+ {
89
+ label: 'header',
90
+ value: 'header',
91
+ mode: 'info',
92
+ },
93
+ {
94
+ label: 'formdata',
95
+ value: 'formdata',
96
+ mode: 'info',
97
+ },
98
+ {
99
+ label: 'response',
100
+ value: 'response',
101
+ mode: 'info',
102
+ },
103
+ ];
104
+ const currentSelect = ref('header');
105
+
106
+ const formData = computed(() => {
107
+ try {
108
+ if (props.upload.formData) {
109
+ return {
110
+ value: JSON.parse(JSON.stringify(props.upload.formData)),
111
+ type: 'object',
112
+ };
113
+ }
114
+ return {
115
+ value: {},
116
+ type: 'empty',
117
+ };
118
+ } catch (error) {
119
+ return {
120
+ value: JSON.parse(JSON.stringify(props.upload.formData)),
121
+ type: 'object',
122
+ };
123
+ }
124
+ });
125
+
126
+ const response = computed(() => {
127
+ try {
128
+ if (props.upload.response) {
129
+ return {
130
+ value: JSON.parse(JSON.stringify(props.upload.response)),
131
+ type: 'object',
132
+ };
133
+ }
134
+ return {
135
+ value: {},
136
+ type: 'empty',
137
+ };
138
+ } catch (error) {
139
+ return {
140
+ value: props.upload.response,
141
+ type: props.upload.response ? 'string' : 'empty',
142
+ };
143
+ }
144
+ });
145
+
146
+ function onSelect(item: { label: string; value: string }) {
147
+ currentSelect.value = item.value;
148
+ }
149
+
150
+ function onClose() {
151
+ emit('close');
152
+ }
153
+ </script>
154
+ <style>
155
+ .upload-detail {
156
+ position: fixed;
157
+ width: 100vw;
158
+ height: 100vh;
159
+ z-index: 1001;
160
+ top: 0;
161
+ left: 0;
162
+ padding: 0 16px;
163
+ background-color: var(--dev-tool-bg2-color);
164
+ box-sizing: border-box;
165
+ transform: background-color 0.3s;
166
+ }
167
+ .upload-detail .upload-detail-control {
168
+ display: flex;
169
+ align-items: center;
170
+ margin-bottom: 4px;
171
+ gap: 12px;
172
+ height: 32px;
173
+ border-bottom: 1px solid transparent;
174
+ box-sizing: border-box;
175
+ }
176
+
177
+ .upload-detail .upload-detail-header .net-detail-item {
178
+ display: flex;
179
+ align-items: center;
180
+ min-height: 28px;
181
+ word-break: break-all;
182
+ }
183
+ .upload-detail .upload-detail-header .net-detail-item > view:first-child {
184
+ white-space: nowrap;
185
+ margin-right: 8px;
186
+ color: var(--dev-tool-info-color);
187
+ }
188
+ .upload-detail .upload-detail-payload {
189
+ word-break: break-all;
190
+ max-width: 100%;
191
+ }
192
+ </style>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <view class="upload-item">
3
+ <view class="upload-url-row">
4
+ <Tag mode="info">POST</Tag>
5
+ <view class="upload-url" v-html="upload.url" />
6
+ <Tag
7
+ mode="main"
8
+ class="upload-detail-icon"
9
+ @click="showDetail = !showDetail"
10
+ >详情</Tag
11
+ >
12
+ </view>
13
+ <view class="upload-info">
14
+ <view>
15
+ <Tag v-if="upload.status === 'pending'" mode="info">
16
+ {{ upload.status }}
17
+ </Tag>
18
+ <Tag v-if="upload.status === 'uploading'" mode="warn">
19
+ {{ upload.status }}
20
+ </Tag>
21
+ <Tag v-if="upload.status === 'success'" mode="success">
22
+ {{ upload.status }}
23
+ </Tag>
24
+ <Tag v-if="upload.status === 'error'" mode="error">
25
+ {{ upload.status }}
26
+ </Tag>
27
+ </view>
28
+ <view>进度: {{ upload.progress }}%</view>
29
+ <view>
30
+ 开始:
31
+ {{ upload.startTime ? formatDate(upload.startTime, ' HH:mm:ss') : '-' }}
32
+ </view>
33
+ <view>
34
+ 结束:
35
+ {{ upload.endTime ? formatDate(upload.endTime, ' HH:mm:ss') : '-' }}
36
+ </view>
37
+ </view>
38
+ </view>
39
+ <!-- <Transition name="slide-fade"> -->
40
+ <UploadDetail
41
+ v-if="showDetail"
42
+ :upload="upload"
43
+ :zIndex="zIndex"
44
+ @close="onClose"
45
+ />
46
+ <!-- </Transition> -->
47
+ </template>
48
+
49
+ <script lang="ts" setup>
50
+ import { ref } from 'vue';
51
+ import Tag from '../Tag/index.vue';
52
+ import UploadDetail from './UploadDetail.vue';
53
+ import { formatDate } from '../../utils';
54
+ import type { DevTool } from '../../type';
55
+ defineProps<{
56
+ upload: DevTool.UploadItem;
57
+ zIndex?: number;
58
+ }>();
59
+ const showDetail = ref(false);
60
+
61
+ function onClose() {
62
+ showDetail.value = false;
63
+ }
64
+ </script>
65
+ <style scoped>
66
+ .upload-item {
67
+ padding: 16px;
68
+ border-bottom: 1px solid var(--dev-tool-border-color);
69
+ font-size: var(--dev-tool-base-font-size);
70
+ }
71
+ .upload-item .upload-url-row {
72
+ display: flex;
73
+ align-items: center;
74
+ word-break: break-all;
75
+ }
76
+ .websocket-item .websocket-url-row .websocket-url {
77
+ margin-left: 4px;
78
+ flex: 1;
79
+ white-space: nowrap;
80
+ overflow: hidden;
81
+ text-overflow: ellipsis;
82
+ }
83
+
84
+ .upload-item .upload-url-row .upload-detail-icon {
85
+ flex-shrink: 0;
86
+ margin-left: auto;
87
+ }
88
+ .upload-url {
89
+ margin-left: 4px;
90
+ flex: 1;
91
+ white-space: nowrap;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ }
95
+ .upload-item .upload-url-row .upload-detail-active {
96
+ transform: rotate(135deg);
97
+ }
98
+ .upload-item .upload-info {
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: space-between;
102
+ margin-top: 4px;
103
+ color: var(--dev-tool-text-color);
104
+ }
105
+
106
+ .slide-fade-enter-active {
107
+ transition: all 0.8s ease-out;
108
+ }
109
+ .slide-fade-leave-active {
110
+ transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);
111
+ }
112
+ .slide-fade-enter-from,
113
+ .slide-fade-leave-to {
114
+ transform: translateY(20px);
115
+ opacity: 0;
116
+ }
117
+ </style>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <view class="upload-content">
3
+ <view class="upload-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 uploadFilterItems"
12
+ :mode="item.mode"
13
+ :key="item.value"
14
+ :active="item.value === currentUploadType"
15
+ @click="onChoose(item.value)"
16
+ >
17
+ {{ item.label }}
18
+ </Tag>
19
+ </view>
20
+ <VirtualListPro
21
+ :data="uploadList"
22
+ :pageSize="15"
23
+ :height="height"
24
+ className="upload-list"
25
+ >
26
+ <template v-slot="{ list, start }">
27
+ <AutoSize
28
+ v-for="(item, index) in list"
29
+ :index="start + index"
30
+ :key="start + index"
31
+ >
32
+ <UploadItem :upload="item" :zIndex="zIndex" />
33
+ </AutoSize>
34
+ <Empty v-if="!uploadList || uploadList.length === 0" />
35
+ </template>
36
+ </VirtualListPro>
37
+ </view>
38
+ </template>
39
+ <script lang="ts" setup>
40
+ import Tag from '../Tag/index.vue';
41
+ import UploadItem from './UploadItem.vue';
42
+ import Empty from '../Empty/index.vue';
43
+ import FilterInput from '../FilterInput/index.vue';
44
+ import type { DevTool } from '../../type';
45
+ import VirtualListPro from '../VirtualListPro/index.vue';
46
+ import AutoSize from '../VirtualListPro/AutoSize.vue';
47
+ import { onMounted, ref } from 'vue';
48
+
49
+ defineProps<{
50
+ currentUploadType: string;
51
+ uploadList: DevTool.UploadItem[];
52
+ modelValue: string;
53
+ zIndex: number;
54
+ }>();
55
+
56
+ const emit = defineEmits<{
57
+ (e: 'choose', type: string): void;
58
+ (e: 'update:modelValue', value: string): void;
59
+ (e: 'search', value: string): void;
60
+ }>();
61
+ const uploadFilterItems = [
62
+ {
63
+ label: '全部',
64
+ value: 'all',
65
+ mode: 'all',
66
+ },
67
+ {
68
+ label: 'pending',
69
+ value: 'pending',
70
+ mode: 'info',
71
+ },
72
+ {
73
+ label: 'success',
74
+ value: 'success',
75
+ mode: 'success',
76
+ },
77
+ {
78
+ label: 'error',
79
+ value: 'error',
80
+ mode: 'error',
81
+ },
82
+ {
83
+ label: '清除',
84
+ value: 'clear',
85
+ mode: 'clear',
86
+ },
87
+ ];
88
+
89
+ function onChoose(type: string) {
90
+ emit('choose', type);
91
+ }
92
+
93
+ const height = ref(0);
94
+ onMounted(() => {
95
+ const { windowHeight } = uni.getWindowInfo();
96
+ height.value = windowHeight - 32 - 32;
97
+ });
98
+ </script>
99
+ <style scoped>
100
+ .upload-content {
101
+ height: 100%;
102
+ font-size: var(--dev-tool-base-font-size);
103
+ }
104
+ .upload-list {
105
+ height: calc(100% - 32px);
106
+ }
107
+ .upload-control {
108
+ display: flex;
109
+ align-items: center;
110
+ justify-content: space-between;
111
+ gap: 8px;
112
+ padding: 0 16px;
113
+ height: 32px;
114
+ border-bottom: 1px solid var(--dev-tool-border-color);
115
+ box-sizing: border-box;
116
+ }
117
+ </style>