vite-uni-dev-tool 0.0.12 → 0.0.13
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.
- package/dist/const.d.ts +133 -0
- package/dist/const.d.ts.map +1 -0
- package/dist/const.js +36 -0
- package/dist/core.d.ts +52 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +80 -0
- package/dist/devConsole/index.d.ts +169 -0
- package/dist/devConsole/index.d.ts.map +1 -0
- package/dist/devConsole/index.js +270 -0
- package/dist/devEvent/index.d.ts +286 -0
- package/dist/devEvent/index.d.ts.map +1 -0
- package/dist/devEvent/index.js +435 -0
- package/dist/devEventBus/index.d.ts +42 -0
- package/dist/devEventBus/index.d.ts.map +1 -0
- package/dist/devEventBus/index.js +70 -0
- package/dist/devIntercept/index.d.ts +119 -0
- package/dist/devIntercept/index.d.ts.map +1 -0
- package/dist/devIntercept/index.js +582 -0
- package/dist/devRunJS/index.d.ts +67 -0
- package/dist/devRunJS/index.d.ts.map +1 -0
- package/dist/devStore/index.d.ts +178 -0
- package/dist/devStore/index.d.ts.map +1 -0
- package/dist/devStore/index.js +395 -0
- package/dist/devToolInfo/index.d.ts +17 -0
- package/dist/devToolInfo/index.d.ts.map +1 -0
- package/dist/devToolInfo/index.js +15 -0
- package/{dev → dist}/plugins/uniDevTool/uniDevTool.d.ts +7 -1
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/uniDevTool.js +35 -0
- package/{dev → dist}/plugins/utils/index.d.ts +3 -0
- package/{dev → dist}/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +1 -0
- package/dist/type.d.ts +264 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/utils/array.d.ts +2 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +12 -0
- package/dist/utils/date.d.ts +19 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +40 -0
- package/dist/utils/file.d.ts +11 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +87 -0
- package/dist/utils/function.d.ts +28 -0
- package/dist/utils/function.d.ts.map +1 -0
- package/dist/utils/function.js +46 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +55 -0
- package/dist/utils/ip.d.ts +5 -0
- package/dist/utils/ip.d.ts.map +1 -0
- package/dist/utils/ip.js +21 -0
- package/dist/utils/language.d.ts +29 -0
- package/dist/utils/language.d.ts.map +1 -0
- package/dist/utils/language.js +50 -0
- package/dist/utils/object.d.ts +49 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +118 -0
- package/dist/utils/page.d.ts +7 -0
- package/dist/utils/page.d.ts.map +1 -0
- package/dist/utils/page.js +7 -0
- package/dist/utils/platform.d.ts +4 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +14 -0
- package/dist/utils/string.d.ts +45 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +88 -0
- package/dist/utils/utils.d.ts +16 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/v2/AutoSizer/utils.d.ts +5 -0
- package/dist/v2/AutoSizer/utils.d.ts.map +1 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.d.ts +4 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.d.ts.map +1 -0
- package/dist/v2/JsonPretty/hooks/useError.d.ts +8 -0
- package/dist/v2/JsonPretty/hooks/useError.d.ts.map +1 -0
- package/dist/v2/JsonPretty/type.d.ts +93 -0
- package/dist/v2/JsonPretty/type.d.ts.map +1 -0
- package/dist/v3/AutoSizer/utils.d.ts +5 -0
- package/dist/v3/AutoSizer/utils.d.ts.map +1 -0
- package/dist/v3/ConsoleList/staticTips.d.ts +13 -0
- package/dist/v3/ConsoleList/staticTips.d.ts.map +1 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +4 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +1 -0
- package/dist/v3/JsonPretty/hooks/useError.d.ts +8 -0
- package/dist/v3/JsonPretty/hooks/useError.d.ts.map +1 -0
- package/dist/v3/JsonPretty/type.d.ts +93 -0
- package/dist/v3/JsonPretty/type.d.ts.map +1 -0
- package/dist/v3/JsonPretty/utils/index.d.ts +10 -0
- package/dist/v3/JsonPretty/utils/index.d.ts.map +1 -0
- package/package.json +5 -5
- package/dev/components/AppInfo/index.vue +0 -36
- package/dev/components/AutoSizer/index.vue +0 -193
- package/dev/components/AutoSizer/index1.vue +0 -186
- package/dev/components/AutoSizer/utils.ts +0 -49
- package/dev/components/Button/index.vue +0 -34
- package/dev/components/CaptureScreen/index.vue +0 -62
- package/dev/components/Checkbox/index.vue +0 -40
- package/dev/components/CloseButton/index.vue +0 -26
- package/dev/components/Code/index.vue +0 -230
- package/dev/components/Connection/index.vue +0 -88
- package/dev/components/ConsoleList/Code.vue +0 -227
- package/dev/components/ConsoleList/ConsoleItem.vue +0 -207
- package/dev/components/ConsoleList/RunJSInput.vue +0 -237
- package/dev/components/ConsoleList/index.vue +0 -139
- package/dev/components/ConsoleList/staticTips.ts +0 -1145
- package/dev/components/DevTool/index.vue +0 -188
- package/dev/components/DevToolButton/index.vue +0 -210
- package/dev/components/DevToolTitle/index.vue +0 -21
- package/dev/components/DevToolWindow/index.vue +0 -1053
- package/dev/components/DeviceInfo/index.vue +0 -32
- package/dev/components/Empty/empty.png +0 -0
- package/dev/components/Empty/index.vue +0 -28
- package/dev/components/FilterInput/index.vue +0 -86
- package/dev/components/JsonPretty/components/Brackets/index.vue +0 -23
- package/dev/components/JsonPretty/components/Carets/index.vue +0 -59
- package/dev/components/JsonPretty/components/CheckController/index.vue +0 -125
- package/dev/components/JsonPretty/components/TreeNode/index.vue +0 -349
- package/dev/components/JsonPretty/hooks/useClipboard.ts +0 -21
- package/dev/components/JsonPretty/hooks/useError.ts +0 -21
- package/dev/components/JsonPretty/index.vue +0 -476
- package/dev/components/JsonPretty/type.ts +0 -125
- package/dev/components/JsonPretty/utils/index.ts +0 -172
- package/dev/components/NetworkList/NetworkDetail.vue +0 -194
- package/dev/components/NetworkList/NetworkItem.vue +0 -119
- package/dev/components/NetworkList/index.vue +0 -128
- package/dev/components/PiniaList/index.vue +0 -64
- package/dev/components/RouteList/index.vue +0 -121
- package/dev/components/RunJS/index.vue +0 -128
- package/dev/components/SettingList/index.vue +0 -222
- package/dev/components/SourceCode/index.vue +0 -231
- package/dev/components/StorageList/index.vue +0 -170
- package/dev/components/SystemInfo/index.vue +0 -34
- package/dev/components/Tabs/index.vue +0 -123
- package/dev/components/Tag/index.vue +0 -89
- package/dev/components/UniEvent/UniEventItem.vue +0 -126
- package/dev/components/UniEvent/index.vue +0 -98
- package/dev/components/UploadList/UploadDetail.vue +0 -204
- package/dev/components/UploadList/UploadItem.vue +0 -117
- package/dev/components/UploadList/index.vue +0 -117
- package/dev/components/VirtualList/index.vue +0 -112
- package/dev/components/VirtualListPro/AutoSize.vue +0 -43
- package/dev/components/VirtualListPro/index.vue +0 -238
- package/dev/components/VirtualListPro/readme.md +0 -40
- package/dev/components/VuexList/index.vue +0 -54
- package/dev/components/WebSocket/WebSocketItem.vue +0 -103
- package/dev/components/WebSocket/WebSocketList.vue +0 -173
- package/dev/components/WebSocket/index.vue +0 -124
- package/dev/components/WindowInfo/index.vue +0 -33
- package/dev/const.ts +0 -164
- package/dev/core.ts +0 -118
- package/dev/devConsole/index.ts +0 -350
- package/dev/devEvent/index.ts +0 -810
- package/dev/devEventBus/index.ts +0 -94
- package/dev/devIntercept/index.ts +0 -745
- package/dev/devRunJS/index.ts +0 -170
- package/dev/devStore/index.ts +0 -732
- package/dev/devToolInfo/index.ts +0 -26
- package/dev/plugins/uniDevTool/uniDevTool.d.ts.map +0 -1
- package/dev/plugins/uniDevTool/uniDevTool.js +0 -36
- package/dev/plugins/utils/index.js +0 -1
- package/dev/shims-uni.d.ts +0 -43
- package/dev/type.ts +0 -291
- package/dev/utils/array.ts +0 -15
- package/dev/utils/date.ts +0 -75
- package/dev/utils/file.ts +0 -121
- package/dev/utils/function.ts +0 -192
- package/dev/utils/index.d.ts +0 -6
- package/dev/utils/index.ts +0 -51
- package/dev/utils/ip.ts +0 -79
- package/dev/utils/language.ts +0 -77
- package/dev/utils/object.ts +0 -306
- package/dev/utils/page.ts +0 -13
- package/dev/utils/platform.ts +0 -14
- package/dev/utils/string.ts +0 -133
- package/dev/utils/utils.ts +0 -198
- /package/{dev → dist}/index.d.ts +0 -0
- /package/{dev → dist}/index.d.ts.map +0 -0
- /package/{dev → dist}/index.js +0 -0
- /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.d.ts +0 -0
- /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +0 -0
- /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.js +0 -0
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<scroll-view
|
|
3
|
-
:lower-threshold="preLodeHeight"
|
|
4
|
-
:scroll-with-animation="scrollWithAnimation"
|
|
5
|
-
:class="['virtual-list', className]"
|
|
6
|
-
:style="style"
|
|
7
|
-
:scroll-into-view="innerScrollIntoView"
|
|
8
|
-
scroll-y
|
|
9
|
-
@scroll="onScroll"
|
|
10
|
-
@scrolltolower="onScrollToLower"
|
|
11
|
-
>
|
|
12
|
-
<!-- 阈值判断 -->
|
|
13
|
-
<view
|
|
14
|
-
:id="placeholderId"
|
|
15
|
-
:style="{ height: `${state.currentHeight}px` }"
|
|
16
|
-
></view>
|
|
17
|
-
<view>
|
|
18
|
-
<!-- 将可视数据传入到slot -->
|
|
19
|
-
<slot
|
|
20
|
-
:list="state.visitableData"
|
|
21
|
-
:current="state.current"
|
|
22
|
-
:start="(state.current - 1) * props.pageSize"
|
|
23
|
-
></slot>
|
|
24
|
-
</view>
|
|
25
|
-
|
|
26
|
-
<view
|
|
27
|
-
v-if="state.currentHeight > props.height && showBackTop"
|
|
28
|
-
class="virtual-back-top"
|
|
29
|
-
@click="onBackTop"
|
|
30
|
-
>
|
|
31
|
-
↑
|
|
32
|
-
</view>
|
|
33
|
-
</scroll-view>
|
|
34
|
-
</template>
|
|
35
|
-
<script lang="ts" setup>
|
|
36
|
-
import { nextTick } from 'vue';
|
|
37
|
-
import { uniqueId } from '../../utils';
|
|
38
|
-
import { reactive, watch, onBeforeMount, provide, computed, ref } from 'vue';
|
|
39
|
-
|
|
40
|
-
const props = withDefaults(
|
|
41
|
-
defineProps<{
|
|
42
|
-
/** 渲染数据 */
|
|
43
|
-
data: any[];
|
|
44
|
-
/** 虚拟列表高度 */
|
|
45
|
-
height?: number;
|
|
46
|
-
/**
|
|
47
|
-
* 将对传入的data进行分页
|
|
48
|
-
* 如何获取pageSize?
|
|
49
|
-
* 虚拟列表高度 / 预估每条的最小高度 +
|
|
50
|
-
*/
|
|
51
|
-
pageSize?: number;
|
|
52
|
-
/** 预加载高度 */
|
|
53
|
-
preLodeHeight?: number;
|
|
54
|
-
/** 类名 */
|
|
55
|
-
className?: string;
|
|
56
|
-
/** 滚动到指定元素 */
|
|
57
|
-
scrollIntoView?: string;
|
|
58
|
-
/** 滚动动画 */
|
|
59
|
-
scrollWithAnimation?: boolean;
|
|
60
|
-
/** 返回顶部 */
|
|
61
|
-
showBackTop?: boolean;
|
|
62
|
-
}>(),
|
|
63
|
-
{
|
|
64
|
-
height: 400,
|
|
65
|
-
pageSize: 10,
|
|
66
|
-
preLodeHeight: 50,
|
|
67
|
-
},
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const state = reactive<{
|
|
71
|
-
/** 加载次数 */
|
|
72
|
-
current: number;
|
|
73
|
-
visitableData: any[];
|
|
74
|
-
currentHeight: number;
|
|
75
|
-
height: number;
|
|
76
|
-
scrollTop: number;
|
|
77
|
-
}>({
|
|
78
|
-
height: 0,
|
|
79
|
-
current: 1,
|
|
80
|
-
visitableData: [],
|
|
81
|
-
currentHeight: 0,
|
|
82
|
-
scrollTop: 0,
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
const placeholderId = uniqueId('virtual-placeholder-');
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* 每一项的高度
|
|
89
|
-
*/
|
|
90
|
-
const itemsHeight: number[] = [];
|
|
91
|
-
|
|
92
|
-
provide('itemsHeight', itemsHeight);
|
|
93
|
-
|
|
94
|
-
const style = computed(() => {
|
|
95
|
-
return {
|
|
96
|
-
height:
|
|
97
|
-
typeof props.height === 'string' ? props.height : props.height + 'px',
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const toView = ref('');
|
|
102
|
-
|
|
103
|
-
const innerScrollIntoView = computed(() => {
|
|
104
|
-
return toView.value || props.scrollIntoView;
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
onBeforeMount(() => {
|
|
108
|
-
// 初始渲染数据
|
|
109
|
-
state.visitableData = props.data.slice(0, props.pageSize * 2);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// 数据更新时重置
|
|
113
|
-
watch(
|
|
114
|
-
() => [props.data, props.pageSize],
|
|
115
|
-
() => {
|
|
116
|
-
state.visitableData = props.data.slice(0, props.pageSize * 2);
|
|
117
|
-
},
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
/** 向上滚动和向下滚动 */
|
|
121
|
-
function updateVisitableData(direction: 'up' | 'down') {
|
|
122
|
-
let tempList = [...state.visitableData];
|
|
123
|
-
|
|
124
|
-
if (direction === 'down') {
|
|
125
|
-
// 将最前面的内容进行隐藏
|
|
126
|
-
tempList.splice(0, props.pageSize);
|
|
127
|
-
|
|
128
|
-
// 处理下一页内容
|
|
129
|
-
const start = props.pageSize * state.current;
|
|
130
|
-
let end = props.pageSize * (state.current + 1);
|
|
131
|
-
|
|
132
|
-
if (start >= props.data.length) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (end > props.data.length) {
|
|
137
|
-
end = props.data.length;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const newData = props.data.slice(start, end);
|
|
141
|
-
|
|
142
|
-
tempList.push(...newData);
|
|
143
|
-
} else {
|
|
144
|
-
// 将最末尾的部分进行隐藏
|
|
145
|
-
const delCount =
|
|
146
|
-
tempList.length - props.pageSize > 0
|
|
147
|
-
? props.pageSize
|
|
148
|
-
: tempList.length - props.pageSize;
|
|
149
|
-
|
|
150
|
-
tempList.splice(props.pageSize, delCount);
|
|
151
|
-
|
|
152
|
-
// 处理上一页内容
|
|
153
|
-
let start = props.pageSize * (state.current - 1);
|
|
154
|
-
|
|
155
|
-
const end = props.pageSize * state.current;
|
|
156
|
-
|
|
157
|
-
if (end < 0) return;
|
|
158
|
-
|
|
159
|
-
if (start < 0) {
|
|
160
|
-
start = 0;
|
|
161
|
-
}
|
|
162
|
-
const newData = props.data.slice(start, end);
|
|
163
|
-
tempList.unshift(...newData);
|
|
164
|
-
}
|
|
165
|
-
state.visitableData = tempList;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/** 计算合并的高度 */
|
|
169
|
-
function updateCurrentHeight() {
|
|
170
|
-
const total = itemsHeight
|
|
171
|
-
.slice(0, state.current * props.pageSize)
|
|
172
|
-
?.reduce((acc, cur) => acc + cur, 0);
|
|
173
|
-
|
|
174
|
-
state.currentHeight = total;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** 滚动到底部 */
|
|
178
|
-
function onScrollToLower() {
|
|
179
|
-
if ((state.current + 1) * props.pageSize < props.data.length) {
|
|
180
|
-
state.current++;
|
|
181
|
-
|
|
182
|
-
updateVisitableData('down');
|
|
183
|
-
|
|
184
|
-
updateCurrentHeight();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/** 滚动监听,是否小于合并高度 */
|
|
189
|
-
function onScroll(e: { detail: { scrollTop: number } }) {
|
|
190
|
-
if (
|
|
191
|
-
state.current > 0 &&
|
|
192
|
-
state.currentHeight > 0 &&
|
|
193
|
-
e.detail.scrollTop - props.preLodeHeight < state.currentHeight
|
|
194
|
-
) {
|
|
195
|
-
state.current--;
|
|
196
|
-
|
|
197
|
-
updateVisitableData('up');
|
|
198
|
-
|
|
199
|
-
updateCurrentHeight();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/** 暴露给子组件获取子组件容器的高度 */
|
|
204
|
-
function onSizeChange(index: number, height: number) {
|
|
205
|
-
itemsHeight[index] = height;
|
|
206
|
-
}
|
|
207
|
-
provide('onSizeChange', onSizeChange);
|
|
208
|
-
|
|
209
|
-
/** 返回顶部 */
|
|
210
|
-
function onBackTop() {
|
|
211
|
-
toView.value = placeholderId;
|
|
212
|
-
|
|
213
|
-
nextTick(() => {
|
|
214
|
-
state.current = 1;
|
|
215
|
-
state.currentHeight = 0;
|
|
216
|
-
updateVisitableData('up');
|
|
217
|
-
|
|
218
|
-
toView.value = '';
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
</script>
|
|
222
|
-
<style scoped>
|
|
223
|
-
.virtual-list {
|
|
224
|
-
position: relative;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.virtual-back-top {
|
|
228
|
-
position: sticky;
|
|
229
|
-
bottom: 20px;
|
|
230
|
-
left: 80%;
|
|
231
|
-
display: flex;
|
|
232
|
-
align-items: center;
|
|
233
|
-
justify-content: center;
|
|
234
|
-
width: 40px;
|
|
235
|
-
height: 40px;
|
|
236
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
|
237
|
-
}
|
|
238
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# VirtualListAutoHeight
|
|
2
|
-
|
|
3
|
-
自适应高度虚拟列表
|
|
4
|
-
|
|
5
|
-
## 核心
|
|
6
|
-
|
|
7
|
-
- 初始加载两页数据
|
|
8
|
-
- 初始获取当前加载的渲染列表的数据 ,得到第一页高度
|
|
9
|
-
- scroll-view
|
|
10
|
-
- 滚动到底部(顶部)current + 1
|
|
11
|
-
- createIntersectionObserver
|
|
12
|
-
- 辅助反向监听节点是否出现再可视范围之内
|
|
13
|
-
- current - 1
|
|
14
|
-
- 数据分页之后确定每页高度,采用合并高度支撑滚动条
|
|
15
|
-
- 合并高度计算逻辑: 第一页高度 = 第一页高度
|
|
16
|
-
- 后续页高度 = 前面所有高度 + 当前页高度.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
一页两条
|
|
20
|
-
|
|
21
|
-
pageSize = 2
|
|
22
|
-
current = 2
|
|
23
|
-
visibleDate = [3,4,5,6]
|
|
24
|
-
|
|
25
|
-
visibleDate.splice(1*2, visibleDate.length - 1*2)
|
|
26
|
-
|
|
27
|
-
const start = cur
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
1
|
|
31
|
-
2
|
|
32
|
-
|
|
33
|
-
3
|
|
34
|
-
4
|
|
35
|
-
|
|
36
|
-
5
|
|
37
|
-
6
|
|
38
|
-
|
|
39
|
-
current = 1
|
|
40
|
-
visibleDate = [1,2,3,4]
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="vuex-content">
|
|
3
|
-
<JsonPretty
|
|
4
|
-
:data="vuexList"
|
|
5
|
-
showLength
|
|
6
|
-
editable
|
|
7
|
-
v-if="showJson"
|
|
8
|
-
@update:data="onUpdateData"
|
|
9
|
-
@nodeClick="onNodeClick"
|
|
10
|
-
/>
|
|
11
|
-
<Empty v-else />
|
|
12
|
-
</view>
|
|
13
|
-
</template>
|
|
14
|
-
<script lang="ts" setup>
|
|
15
|
-
import { computed } from 'vue';
|
|
16
|
-
import JsonPretty from '../JsonPretty/index.vue';
|
|
17
|
-
import Empty from '../Empty/index.vue';
|
|
18
|
-
const props = defineProps<{
|
|
19
|
-
vuexList: Record<string, any>;
|
|
20
|
-
}>();
|
|
21
|
-
const emit = defineEmits<{
|
|
22
|
-
(e: 'update:vuexList', data: Record<string, any>): void;
|
|
23
|
-
(e: 'diffValue', value: any): void;
|
|
24
|
-
}>();
|
|
25
|
-
const showJson = computed(() => {
|
|
26
|
-
try {
|
|
27
|
-
const str = JSON.stringify(props.vuexList);
|
|
28
|
-
if (typeof props.vuexList === 'object' && (str === '' || str === '{}')) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
} catch (error) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
let currentSelect: any;
|
|
38
|
-
function onUpdateData(data: Record<string, any>) {
|
|
39
|
-
const firstKey = currentSelect?.path.split('.')?.slice(1)?.[0];
|
|
40
|
-
emit('update:vuexList', data);
|
|
41
|
-
emit('diffValue', {
|
|
42
|
-
[firstKey]: data[firstKey],
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function onNodeClick(node: any) {
|
|
46
|
-
currentSelect = node;
|
|
47
|
-
}
|
|
48
|
-
</script>
|
|
49
|
-
<style scoped>
|
|
50
|
-
.vuex-content {
|
|
51
|
-
padding: 16px;
|
|
52
|
-
font-size: var(--dev-tool-base-font-size);
|
|
53
|
-
}
|
|
54
|
-
</style>
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="websocket-item">
|
|
3
|
-
<view class="websocket-url-row">
|
|
4
|
-
<Tag mode="info" v-if="ws.readyState === 'connection'">con</Tag>
|
|
5
|
-
<Tag mode="success" v-if="ws.readyState === 'open'">open</Tag>
|
|
6
|
-
<Tag
|
|
7
|
-
mode="warn"
|
|
8
|
-
v-if="ws.readyState === 'closing' || ws.readyState === 'closed'"
|
|
9
|
-
>
|
|
10
|
-
close
|
|
11
|
-
</Tag>
|
|
12
|
-
|
|
13
|
-
<Tag mode="error" v-if="ws.readyState === 'error'">error</Tag>
|
|
14
|
-
|
|
15
|
-
<view class="websocket-url" v-html="ws.url" />
|
|
16
|
-
|
|
17
|
-
<Tag
|
|
18
|
-
mode="main"
|
|
19
|
-
class="websocket-detail-icon"
|
|
20
|
-
@click="showDetail = !showDetail"
|
|
21
|
-
>
|
|
22
|
-
详情
|
|
23
|
-
</Tag>
|
|
24
|
-
</view>
|
|
25
|
-
<view class="websocket-info">
|
|
26
|
-
<view class="websocket-info-last">
|
|
27
|
-
{{ ws?.message?.[ws.message.length - 1]?.data }}
|
|
28
|
-
</view>
|
|
29
|
-
|
|
30
|
-
<view>{{
|
|
31
|
-
ws?.message?.[ws.message.length - 1].time
|
|
32
|
-
? formatDate(ws?.message?.[ws.message.length - 1].time, 'HH:mm:ss')
|
|
33
|
-
: '-'
|
|
34
|
-
}}</view>
|
|
35
|
-
</view>
|
|
36
|
-
|
|
37
|
-
<WebSocketList
|
|
38
|
-
v-if="showDetail"
|
|
39
|
-
:ws="ws"
|
|
40
|
-
:zIndex="zIndex"
|
|
41
|
-
@close="onClose"
|
|
42
|
-
/>
|
|
43
|
-
</view>
|
|
44
|
-
</template>
|
|
45
|
-
<script lang="ts" setup>
|
|
46
|
-
import { ref } from 'vue';
|
|
47
|
-
|
|
48
|
-
import Tag from '../Tag/index.vue';
|
|
49
|
-
import WebSocketList from './WebSocketList.vue';
|
|
50
|
-
import { formatDate } from '../../utils';
|
|
51
|
-
import type { DevTool } from '../../type';
|
|
52
|
-
|
|
53
|
-
defineProps<{ ws: DevTool.WS; zIndex?: number }>();
|
|
54
|
-
const showDetail = ref(false);
|
|
55
|
-
|
|
56
|
-
function onClose() {
|
|
57
|
-
showDetail.value = false;
|
|
58
|
-
}
|
|
59
|
-
</script>
|
|
60
|
-
<style scoped>
|
|
61
|
-
.websocket-item {
|
|
62
|
-
padding: 16px;
|
|
63
|
-
|
|
64
|
-
box-sizing: border-box;
|
|
65
|
-
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
66
|
-
font-size: var(--dev-tool-base-font-size);
|
|
67
|
-
}
|
|
68
|
-
.websocket-item .websocket-url-row {
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
word-break: break-all;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.websocket-item .websocket-url-row .websocket-url {
|
|
75
|
-
margin-left: 4px;
|
|
76
|
-
flex: 1;
|
|
77
|
-
white-space: nowrap;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
text-overflow: ellipsis;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.websocket-item .websocket-url-row .websocket-detail-icon {
|
|
83
|
-
flex-shrink: 0;
|
|
84
|
-
margin-left: auto;
|
|
85
|
-
}
|
|
86
|
-
.websocket-item .websocket-url-row .websocket-detail-active {
|
|
87
|
-
transform: rotate(135deg);
|
|
88
|
-
}
|
|
89
|
-
.websocket-item .websocket-info {
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: space-between;
|
|
93
|
-
margin-top: 4px;
|
|
94
|
-
color: #616161;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.websocket-item .websocket-info .websocket-info-last {
|
|
98
|
-
white-space: nowrap;
|
|
99
|
-
flex: 1;
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
text-overflow: ellipsis;
|
|
102
|
-
}
|
|
103
|
-
</style>
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="web-socket-list-container" :style="{ zIndex: zIndex }">
|
|
3
|
-
<view class="web-socket-top">
|
|
4
|
-
请求url:
|
|
5
|
-
|
|
6
|
-
<CloseButton style="margin-left: auto" @click="onClose" />
|
|
7
|
-
</view>
|
|
8
|
-
<view class="web-socket-url">
|
|
9
|
-
{{ ws.url }}
|
|
10
|
-
</view>
|
|
11
|
-
|
|
12
|
-
<view class="web-socket-data">
|
|
13
|
-
<view class="web-socket-title"
|
|
14
|
-
>请求方式:<Tag mode="info"> {{ ws.method }} </Tag></view
|
|
15
|
-
>
|
|
16
|
-
<view class="web-socket-title">请求头:</view>
|
|
17
|
-
<view
|
|
18
|
-
class="header-detail-item"
|
|
19
|
-
v-for="item in ws.headers"
|
|
20
|
-
:key="item.key"
|
|
21
|
-
>
|
|
22
|
-
<view>{{ item.key }}: </view>
|
|
23
|
-
{{ item.value }}
|
|
24
|
-
</view>
|
|
25
|
-
|
|
26
|
-
<view class="web-socket-title">消息列表:</view>
|
|
27
|
-
<view class="web-socket-data-list">
|
|
28
|
-
<view
|
|
29
|
-
v-for="item in ws.message"
|
|
30
|
-
:key="item.time"
|
|
31
|
-
:class="`web-socket-data-item web-socket-data-item-${item.type}`"
|
|
32
|
-
@click="onClick(item)"
|
|
33
|
-
>
|
|
34
|
-
<view class="web-socket-data-time"
|
|
35
|
-
>{{ formatDate(item.time, 'HH:mm:ss') }}
|
|
36
|
-
</view>
|
|
37
|
-
<view class="web-socket-data-content">
|
|
38
|
-
{{ item.data }}
|
|
39
|
-
</view>
|
|
40
|
-
</view>
|
|
41
|
-
</view>
|
|
42
|
-
</view>
|
|
43
|
-
</view>
|
|
44
|
-
</template>
|
|
45
|
-
<script setup lang="ts">
|
|
46
|
-
import Tag from '../Tag/index.vue';
|
|
47
|
-
import CloseButton from '../CloseButton/index.vue';
|
|
48
|
-
import { formatDate } from '../../utils/index';
|
|
49
|
-
import type { DevTool } from '../../type';
|
|
50
|
-
|
|
51
|
-
defineProps<{ ws: DevTool.WS; zIndex?: number }>();
|
|
52
|
-
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
53
|
-
|
|
54
|
-
function onClose() {
|
|
55
|
-
emit('close');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function onClick(item: {
|
|
59
|
-
type: 'success' | 'error';
|
|
60
|
-
data: string;
|
|
61
|
-
time: number;
|
|
62
|
-
}) {
|
|
63
|
-
uni.setClipboardData({
|
|
64
|
-
data: JSON.stringify(item),
|
|
65
|
-
success() {
|
|
66
|
-
uni.showToast({
|
|
67
|
-
title: '复制成功',
|
|
68
|
-
icon: 'none',
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
fail() {
|
|
72
|
-
uni.showToast({
|
|
73
|
-
title: '复制失败',
|
|
74
|
-
icon: 'none',
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
</script>
|
|
80
|
-
<style>
|
|
81
|
-
.web-socket-list-container {
|
|
82
|
-
position: fixed;
|
|
83
|
-
width: 100vw;
|
|
84
|
-
height: 100vh;
|
|
85
|
-
z-index: 1001;
|
|
86
|
-
top: 0;
|
|
87
|
-
left: 0;
|
|
88
|
-
padding: 0 16px;
|
|
89
|
-
|
|
90
|
-
background-color: rgba(255, 255, 255, 0.95);
|
|
91
|
-
box-sizing: border-box;
|
|
92
|
-
}
|
|
93
|
-
.web-socket-list-title {
|
|
94
|
-
min-height: 32px;
|
|
95
|
-
display: flex;
|
|
96
|
-
align-items: center;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.web-socket-data {
|
|
100
|
-
height: calc(100% - 32px);
|
|
101
|
-
overflow: auto;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.web-socket-url {
|
|
105
|
-
display: flex;
|
|
106
|
-
align-items: center;
|
|
107
|
-
min-height: 28px;
|
|
108
|
-
|
|
109
|
-
white-space: wrap;
|
|
110
|
-
word-break: break-all;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.web-socket-close {
|
|
114
|
-
flex-shrink: 0;
|
|
115
|
-
display: flex;
|
|
116
|
-
align-items: center;
|
|
117
|
-
justify-content: center;
|
|
118
|
-
width: 24px;
|
|
119
|
-
height: 24px;
|
|
120
|
-
margin-left: auto;
|
|
121
|
-
border-radius: 50%;
|
|
122
|
-
border: 1px solid #000;
|
|
123
|
-
box-sizing: border-box;
|
|
124
|
-
}
|
|
125
|
-
.web-socket-top {
|
|
126
|
-
display: flex;
|
|
127
|
-
align-items: center;
|
|
128
|
-
height: 32px;
|
|
129
|
-
|
|
130
|
-
border-bottom: 1px solid transparent;
|
|
131
|
-
box-sizing: border-box;
|
|
132
|
-
}
|
|
133
|
-
.web-socket-title {
|
|
134
|
-
display: flex;
|
|
135
|
-
align-items: center;
|
|
136
|
-
}
|
|
137
|
-
.header-detail-item {
|
|
138
|
-
display: flex;
|
|
139
|
-
align-items: center;
|
|
140
|
-
min-height: 28px;
|
|
141
|
-
word-break: break-all;
|
|
142
|
-
}
|
|
143
|
-
.header-detail-item > view:first-child {
|
|
144
|
-
white-space: nowrap;
|
|
145
|
-
margin-right: 8px;
|
|
146
|
-
color: #616161;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.web-socket-data-item {
|
|
150
|
-
display: flex;
|
|
151
|
-
align-items: center;
|
|
152
|
-
min-height: 28px;
|
|
153
|
-
}
|
|
154
|
-
.web-socket-data-item-error {
|
|
155
|
-
background-color: var(--dev-tool-error-bg-color);
|
|
156
|
-
}
|
|
157
|
-
.web-socket-data-item-success {
|
|
158
|
-
background-color: var(--dev-tool-success-bg-color);
|
|
159
|
-
}
|
|
160
|
-
.web-socket-data-time {
|
|
161
|
-
/* margin-right: 16px; */
|
|
162
|
-
padding: 0 6px;
|
|
163
|
-
flex-shrink: 0;
|
|
164
|
-
color: #616161;
|
|
165
|
-
}
|
|
166
|
-
.web-socket-data-content {
|
|
167
|
-
padding: 6px;
|
|
168
|
-
flex: 1;
|
|
169
|
-
overflow: hidden;
|
|
170
|
-
text-overflow: ellipsis;
|
|
171
|
-
word-break: break-all;
|
|
172
|
-
}
|
|
173
|
-
</style>
|