vite-uni-dev-tool 0.0.11 → 0.0.12
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/README.md +55 -1
- package/dev/components/ConsoleList/ConsoleItem.vue +24 -3
- package/dev/components/ConsoleList/RunJSInput.vue +3 -1
- package/dev/components/ConsoleList/index.vue +11 -2
- package/dev/components/DevTool/index.vue +37 -31
- package/dev/components/DevToolButton/index.vue +9 -12
- package/dev/components/DevToolTitle/index.vue +2 -2
- package/dev/components/DevToolWindow/index.vue +32 -16
- package/dev/components/JsonPretty/index.vue +2 -0
- package/dev/components/NetworkList/NetworkDetail.vue +3 -6
- package/dev/components/NetworkList/NetworkItem.vue +21 -8
- package/dev/components/NetworkList/index.vue +15 -2
- package/dev/components/RouteList/index.vue +12 -1
- package/dev/components/SettingList/index.vue +2 -5
- package/dev/components/SourceCode/index.vue +231 -0
- package/dev/components/UniEvent/UniEventItem.vue +4 -2
- package/dev/components/UniEvent/index.vue +7 -3
- package/dev/components/UploadList/UploadDetail.vue +3 -7
- package/dev/components/UploadList/UploadItem.vue +7 -1
- package/dev/components/UploadList/index.vue +15 -2
- package/dev/components/VirtualListPro/index.vue +67 -4
- package/dev/components/VuexList/index.vue +2 -2
- package/dev/components/WebSocket/WebSocketItem.vue +7 -2
- package/dev/components/WebSocket/WebSocketList.vue +3 -6
- package/dev/components/WebSocket/index.vue +15 -2
- package/dev/const.ts +11 -13
- package/dev/devEvent/index.ts +20 -16
- package/dev/devStore/index.ts +27 -13
- package/dev/devToolInfo/index.ts +26 -0
- package/dev/plugins/uniDevTool/uniDevTool.d.ts +9 -1
- package/dev/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dev/plugins/uniDevTool/uniDevTool.js +36 -36
- package/dev/plugins/uniGlobalComponents/uniGlobalComponents.js +7 -7
- package/dev/type.ts +27 -0
- package/dev/utils/index.ts +5 -0
- package/dev/utils/language.ts +8 -3
- package/dev/utils/object.ts +10 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,10 @@ import * as path from 'path';
|
|
|
27
27
|
|
|
28
28
|
// https://vitejs.dev/config/
|
|
29
29
|
export default defineConfig({
|
|
30
|
+
optimizeDeps: {
|
|
31
|
+
// 预构建排除 vite-uni-dev-tool 模块,防止 eventBus 冲突
|
|
32
|
+
exclude: ['vite-uni-dev-tool'],
|
|
33
|
+
},
|
|
30
34
|
plugins: [
|
|
31
35
|
// 一定要在 uni() 之前调用 否则微信小程序将无法正常编译组件
|
|
32
36
|
uniDevTool({
|
|
@@ -46,6 +50,28 @@ export default defineConfig({
|
|
|
46
50
|
});
|
|
47
51
|
```
|
|
48
52
|
|
|
53
|
+
### uniDevTool 配置项
|
|
54
|
+
|
|
55
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
56
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------------- | -------- | ---------------------- |
|
|
57
|
+
| pages | 配置pages.json | object | {} |
|
|
58
|
+
| enableInterceptPromiseReject | 是否拦截Promise.reject 最好不要拦截 默认禁用 | boolean | false |
|
|
59
|
+
| consoleMaxSize | 最大的console条数 | number | 1000 |
|
|
60
|
+
| networkMaxSize | 最大的网络请求条数 | number | 1000 |
|
|
61
|
+
| uploadMaxSize | 最大的上传文件条数 | number | 1000 |
|
|
62
|
+
| wsDataMaxSize | 最大的套接字消息条数 | number | 1000 |
|
|
63
|
+
| captureScreenMaxSize | 最大的截图记录条数 | number | 1000 |
|
|
64
|
+
| cacheMaxSize | 最大占用缓存空间 bytes | number | 8\*1024\*1024\*10 |
|
|
65
|
+
| buttonSize | 按钮大小 | number | 50 |
|
|
66
|
+
| buttonText | 按钮文本 | string | 🐜 |
|
|
67
|
+
| buttonFontSize | 按钮字体大小 | string | 16px |
|
|
68
|
+
| buttonBackgroundColor | 按钮背景颜色 | string | rgba(255, 255, 255, 0) |
|
|
69
|
+
| initShowDevTool | 初始化时是否显示调试按钮,默认显示 | boolean | true |
|
|
70
|
+
| zIndex | 调试按钮的zIndex,默认1000 | number | 1000 |
|
|
71
|
+
| useDevSource | 该属性处于实验当中,谨慎使用,读取开发环境 source file,source map,默认 禁用 | boolean | false |
|
|
72
|
+
| sourceFileServers | 该属性处于实验当中,谨慎使用,开发环境 source file 服务器地址,默认 [] ,配合 useDevSource 使用 | string[] | [] |
|
|
73
|
+
| importConsole | 是否导入 console 默认不导入, 只会捕获error 和 warn | boolean | false |
|
|
74
|
+
|
|
49
75
|
### 为什么不用 subPackages?
|
|
50
76
|
|
|
51
77
|
- 从当前页跳转到subPackages页面时,会触发 uni-app 页面生命周期,有时是不希望如此的,比如在开发过程中,希望可以直接在当前页面进行调试。
|
|
@@ -53,7 +79,6 @@ export default defineConfig({
|
|
|
53
79
|
### 如何将 console 日志输出到控制台
|
|
54
80
|
|
|
55
81
|
- 0.0.5版本之后为了在生产环境中移除插件,开发环境中插件将会自动导入 `console`,无需手动导入
|
|
56
|
-
|
|
57
82
|
- 0.0.5版本之后不推荐使用 `uni.__dev__console` , 在未来版本中可能会进行移除
|
|
58
83
|
|
|
59
84
|
```ts
|
|
@@ -67,6 +92,24 @@ console.log('hello vite-uni-dev-tool');
|
|
|
67
92
|
uni.__dev__console.log('hello vite-uni-dev-tool');
|
|
68
93
|
```
|
|
69
94
|
|
|
95
|
+
### 0.0.12 版本在插件中增加了 `importConsole` 属性,默认不导入,只捕获`error`, `warn`, 用户手动调用的`console` 将不再进行捕获,如需捕获传入`true`即可
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
uniDevTool({
|
|
99
|
+
pages,
|
|
100
|
+
importConsole: true
|
|
101
|
+
}),
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### vite 预加载导致的 `eventBus` 事件冲突 , 预加载排除 `vite-uni-dev-tool` 即可
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
optimizeDeps: {
|
|
108
|
+
// 预构建排除 vite-uni-dev-tool 模块,防止 eventBus 冲突
|
|
109
|
+
exclude: ['vite-uni-dev-tool'],
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
70
113
|
### 注意事项
|
|
71
114
|
|
|
72
115
|
### 兼容性说明
|
|
@@ -151,6 +194,17 @@ uni.__dev__console.log('hello vite-uni-dev-tool');
|
|
|
151
194
|
|
|
152
195
|
## 更新日志
|
|
153
196
|
|
|
197
|
+
### 0.0.12
|
|
198
|
+
|
|
199
|
+
- 修复 network url显示长度
|
|
200
|
+
- 修复部分样式
|
|
201
|
+
- 修复列表高度异常
|
|
202
|
+
- 修复销毁之后操作
|
|
203
|
+
- 刷新之后隐藏调试弹窗
|
|
204
|
+
- 列表返回到顶部
|
|
205
|
+
- 增加层级属性,默认层级1000
|
|
206
|
+
- 构建导致的 eventBus 冲突
|
|
207
|
+
|
|
154
208
|
### 0.0.11
|
|
155
209
|
|
|
156
210
|
- 新增 console run 简易提示
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<template v-for="(item, index) in consoleItem.args">
|
|
6
6
|
<view
|
|
7
7
|
v-if="item.type !== 'array' && item.type !== 'object'"
|
|
8
|
-
class="console-arg"
|
|
8
|
+
:class="`console-arg console-arg-${item.type}`"
|
|
9
9
|
:key="index"
|
|
10
10
|
v-html="item.value"
|
|
11
11
|
>
|
|
@@ -46,11 +46,12 @@
|
|
|
46
46
|
</view>
|
|
47
47
|
</view>
|
|
48
48
|
<!-- <view class="console-copy">C</view> -->
|
|
49
|
-
<
|
|
49
|
+
<SourceCode
|
|
50
50
|
v-if="openCode && consoleItem.stack"
|
|
51
51
|
:url="consoleItem.stack"
|
|
52
52
|
:sourceFileServers="sourceFileServers"
|
|
53
53
|
:mode="mode"
|
|
54
|
+
:zIndex="zIndex"
|
|
54
55
|
@close="onCloseCode"
|
|
55
56
|
/>
|
|
56
57
|
</view>
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
<script setup lang="ts">
|
|
60
61
|
import { ref, computed } from 'vue';
|
|
61
62
|
import Tag from '../Tag/index.vue';
|
|
62
|
-
import
|
|
63
|
+
import SourceCode from '../SourceCode/index.vue';
|
|
63
64
|
import type { DevTool } from '../../type';
|
|
64
65
|
import { isAndroid, isMockWX } from '../../utils';
|
|
65
66
|
import JsonPretty from '../JsonPretty/index.vue';
|
|
@@ -68,6 +69,7 @@ const props = defineProps<{
|
|
|
68
69
|
sourceFileServers?: string[];
|
|
69
70
|
mode?: string;
|
|
70
71
|
useDevSource?: boolean;
|
|
72
|
+
zIndex?: number;
|
|
71
73
|
id: string;
|
|
72
74
|
}>();
|
|
73
75
|
|
|
@@ -183,4 +185,23 @@ function onCloseCode() {
|
|
|
183
185
|
.console-item-log {
|
|
184
186
|
color: #f9f9f9;
|
|
185
187
|
}
|
|
188
|
+
|
|
189
|
+
.console-arg-null {
|
|
190
|
+
color: #020201;
|
|
191
|
+
}
|
|
192
|
+
.console-arg-undefined {
|
|
193
|
+
color: #020201;
|
|
194
|
+
}
|
|
195
|
+
.console-arg-string {
|
|
196
|
+
color: #888888;
|
|
197
|
+
}
|
|
198
|
+
.console-arg-number {
|
|
199
|
+
color: #1d8ce0;
|
|
200
|
+
}
|
|
201
|
+
.console-arg-boolean {
|
|
202
|
+
color: #1d8ce0;
|
|
203
|
+
}
|
|
204
|
+
.console-arg-symbol {
|
|
205
|
+
color: bisque;
|
|
206
|
+
}
|
|
186
207
|
</style>
|
|
@@ -180,10 +180,12 @@ function findFunction(fn: string) {
|
|
|
180
180
|
.run-js-input-wrapper {
|
|
181
181
|
position: relative;
|
|
182
182
|
display: flex;
|
|
183
|
+
align-items: center;
|
|
183
184
|
padding: 0 16px;
|
|
184
|
-
|
|
185
|
+
height: 32px;
|
|
185
186
|
border-top: 1px solid var(--dev-tool-border-color);
|
|
186
187
|
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
188
|
+
box-sizing: border-box;
|
|
187
189
|
}
|
|
188
190
|
|
|
189
191
|
.run-js-input-icon {
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
<VirtualListPro
|
|
21
21
|
:data="consoleList"
|
|
22
|
-
:pageSize="
|
|
22
|
+
:pageSize="15"
|
|
23
23
|
:scrollIntoView="scrollIntoView"
|
|
24
24
|
:scrollWithAnimation="true"
|
|
25
|
+
:height="height"
|
|
25
26
|
className="console-list"
|
|
26
27
|
>
|
|
27
28
|
<template v-slot="{ list, start }">
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
:mode="mode"
|
|
37
38
|
:useDevSource="useDevSource"
|
|
38
39
|
:id="`dev-console-${index}`"
|
|
40
|
+
:zIndex="zIndex"
|
|
39
41
|
/>
|
|
40
42
|
</AutoSize>
|
|
41
43
|
<Empty v-if="!consoleList || consoleList.length === 0" />
|
|
@@ -51,7 +53,7 @@ import Empty from '../Empty/index.vue';
|
|
|
51
53
|
import FilterInput from '../FilterInput/index.vue';
|
|
52
54
|
import RunJSInput from './RunJSInput.vue';
|
|
53
55
|
import type { DevTool } from '../../type';
|
|
54
|
-
import { ref, watch } from 'vue';
|
|
56
|
+
import { onMounted, ref, watch } from 'vue';
|
|
55
57
|
import { debounce } from '../../utils';
|
|
56
58
|
import VirtualListPro from '../VirtualListPro/index.vue';
|
|
57
59
|
import AutoSize from '../VirtualListPro/AutoSize.vue';
|
|
@@ -64,6 +66,7 @@ const props = defineProps<{
|
|
|
64
66
|
sourceFileServers?: string[];
|
|
65
67
|
mode?: string;
|
|
66
68
|
useDevSource?: boolean;
|
|
69
|
+
zIndex?: number;
|
|
67
70
|
}>();
|
|
68
71
|
const emit = defineEmits<{
|
|
69
72
|
(e: 'choose', type: ConsoleType): void;
|
|
@@ -108,6 +111,12 @@ const debounceWatch = debounce(() => {
|
|
|
108
111
|
}, 200);
|
|
109
112
|
|
|
110
113
|
watch(() => props.consoleList, debounceWatch);
|
|
114
|
+
|
|
115
|
+
const height = ref(0);
|
|
116
|
+
onMounted(() => {
|
|
117
|
+
const { windowHeight } = uni.getWindowInfo();
|
|
118
|
+
height.value = windowHeight - 32 - 32 - 32;
|
|
119
|
+
});
|
|
111
120
|
</script>
|
|
112
121
|
<style scoped>
|
|
113
122
|
.console-content {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
:buttonColor="buttonProps.buttonColor"
|
|
8
8
|
:buttonFontSize="buttonProps.buttonFontSize"
|
|
9
9
|
:buttonBackgroundColor="buttonProps.buttonBackgroundColor"
|
|
10
|
+
:zIndex="zIndex"
|
|
10
11
|
@click="onDevToolButtonClick"
|
|
11
12
|
/>
|
|
12
13
|
<DevToolWindow
|
|
@@ -15,12 +16,10 @@
|
|
|
15
16
|
:sourceFileServers="sourceFileServers"
|
|
16
17
|
:mode="mode"
|
|
17
18
|
:useDevSource="useDevSource"
|
|
19
|
+
:zIndex="zIndex + 1"
|
|
18
20
|
@close="onShowDevToolWindow(false)"
|
|
19
21
|
@sendMessage="onSendMessage"
|
|
20
22
|
/>
|
|
21
|
-
<!-- <view class="devTool-canvas">
|
|
22
|
-
<canvas canvas-id="fullscreenCanvas" id="fullscreenCanvas" />
|
|
23
|
-
</view> -->
|
|
24
23
|
</view>
|
|
25
24
|
</template>
|
|
26
25
|
<script lang="ts" setup>
|
|
@@ -31,8 +30,8 @@ import DevToolWindow from '../DevToolWindow/index.vue';
|
|
|
31
30
|
import { eventBus } from '../../core';
|
|
32
31
|
|
|
33
32
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
DEV_BUTTON_VISIBLE,
|
|
34
|
+
DEV_WINDOW_VISIBLE,
|
|
36
35
|
DEV_WINDOW_MESSAGE,
|
|
37
36
|
DEV_WINDOW_OPEN,
|
|
38
37
|
DEV_WINDOW_CLOSE,
|
|
@@ -40,6 +39,7 @@ import {
|
|
|
40
39
|
DEV_OPTION_SEND,
|
|
41
40
|
} from '../../const';
|
|
42
41
|
import type { DevTool } from '../../type';
|
|
42
|
+
import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
|
|
43
43
|
|
|
44
44
|
let isActive = false;
|
|
45
45
|
|
|
@@ -60,6 +60,8 @@ const sourceFileServers = ref<string[]>([]);
|
|
|
60
60
|
|
|
61
61
|
const mode = ref<string>();
|
|
62
62
|
|
|
63
|
+
const zIndex = ref(1000);
|
|
64
|
+
|
|
63
65
|
const useDevSource = ref(false);
|
|
64
66
|
|
|
65
67
|
function onDevToolButtonClick() {
|
|
@@ -72,14 +74,20 @@ function onDevToolButtonClick() {
|
|
|
72
74
|
|
|
73
75
|
function onShowDevToolButton(show: boolean) {
|
|
74
76
|
if (!isActive) return;
|
|
75
|
-
|
|
77
|
+
|
|
78
|
+
const { devToolButtonVisible: showButton = false } = getDevToolInfo();
|
|
79
|
+
|
|
80
|
+
devToolButtonVisible.value = show ?? showButton;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
async function onShowDevToolWindow(show: boolean) {
|
|
79
84
|
if (!isActive) return;
|
|
80
85
|
|
|
81
86
|
devToolWindowVisible.value = show;
|
|
82
|
-
|
|
87
|
+
|
|
88
|
+
setDevToolInfo({
|
|
89
|
+
devToolWindowVisible: show,
|
|
90
|
+
});
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
function onSendMessage(param: { type: string; data: Record<string, any> }) {
|
|
@@ -100,19 +108,25 @@ function onDevOptionSend(options: DevTool.DevToolOptions) {
|
|
|
100
108
|
mode.value = options.mode ?? '';
|
|
101
109
|
|
|
102
110
|
useDevSource.value = options.useDevSource ?? false;
|
|
111
|
+
|
|
112
|
+
zIndex.value = options.zIndex ?? 1000;
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
|
|
106
116
|
onLoad(() => {
|
|
107
117
|
// 共享状态
|
|
108
118
|
|
|
109
|
-
const
|
|
119
|
+
const {
|
|
120
|
+
devToolButtonVisible: showButton = false,
|
|
121
|
+
|
|
122
|
+
devToolWindowVisible: showWindow = false,
|
|
123
|
+
} = getDevToolInfo();
|
|
110
124
|
|
|
111
125
|
isActive = true;
|
|
112
|
-
devToolButtonVisible.value =
|
|
113
|
-
devToolWindowVisible.value =
|
|
114
|
-
eventBus.on(
|
|
115
|
-
eventBus.on(
|
|
126
|
+
devToolButtonVisible.value = showButton;
|
|
127
|
+
devToolWindowVisible.value = showWindow;
|
|
128
|
+
eventBus.on(DEV_BUTTON_VISIBLE, onShowDevToolButton);
|
|
129
|
+
eventBus.on(DEV_WINDOW_VISIBLE, onShowDevToolWindow);
|
|
116
130
|
eventBus.on(DEV_OPTION_SEND, onDevOptionSend);
|
|
117
131
|
|
|
118
132
|
nextTick(() => {
|
|
@@ -125,14 +139,21 @@ onUnload(() => {
|
|
|
125
139
|
type: DEV_WINDOW_CLOSE,
|
|
126
140
|
data: {},
|
|
127
141
|
});
|
|
128
|
-
eventBus.off(
|
|
129
|
-
eventBus.off(
|
|
142
|
+
eventBus.off(DEV_BUTTON_VISIBLE, onShowDevToolButton);
|
|
143
|
+
eventBus.off(DEV_WINDOW_VISIBLE, onShowDevToolWindow);
|
|
130
144
|
});
|
|
131
145
|
|
|
132
146
|
onShow(() => {
|
|
133
147
|
isActive = true;
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
const {
|
|
149
|
+
devToolButtonVisible: showButton = false,
|
|
150
|
+
|
|
151
|
+
devToolWindowVisible: showWindow = false,
|
|
152
|
+
} = getDevToolInfo();
|
|
153
|
+
|
|
154
|
+
devToolWindowVisible.value = showWindow;
|
|
155
|
+
devToolButtonVisible.value = showButton;
|
|
156
|
+
|
|
136
157
|
if (devToolWindowVisible.value) {
|
|
137
158
|
onSendMessage({
|
|
138
159
|
type: DEV_WINDOW_OPEN,
|
|
@@ -164,19 +185,4 @@ onHide(() => {
|
|
|
164
185
|
|
|
165
186
|
-webkit-tap-highlight-color: transparent;
|
|
166
187
|
}
|
|
167
|
-
|
|
168
|
-
.dev-tool-canvas {
|
|
169
|
-
position: fixed;
|
|
170
|
-
z-index: -1000;
|
|
171
|
-
top: 0;
|
|
172
|
-
left: 0;
|
|
173
|
-
width: 100vw;
|
|
174
|
-
height: 100vh;
|
|
175
|
-
opacity: 0;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
#fullscreenCanvas {
|
|
179
|
-
width: 100vw;
|
|
180
|
-
height: 100vh;
|
|
181
|
-
}
|
|
182
188
|
</style>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
width: props.buttonSize + 'px',
|
|
10
10
|
height: props.buttonSize + 'px',
|
|
11
11
|
cursor: isDragging ? 'move' : 'pointer',
|
|
12
|
+
zIndex: zIndex,
|
|
12
13
|
...buttonPosition,
|
|
13
14
|
}"
|
|
14
15
|
@touchstart="onTouchStart"
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
<script lang="ts" setup>
|
|
23
24
|
import { onShow, onHide } from '@dcloudio/uni-app';
|
|
24
25
|
import { ref, computed, reactive, onMounted } from 'vue';
|
|
25
|
-
import {
|
|
26
|
+
import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
|
|
26
27
|
|
|
27
28
|
const emit = defineEmits<{ (e: 'click'): void }>();
|
|
28
29
|
const props = withDefaults(
|
|
@@ -32,8 +33,9 @@ const props = withDefaults(
|
|
|
32
33
|
buttonColor?: string;
|
|
33
34
|
buttonFontSize?: string;
|
|
34
35
|
buttonBackgroundColor?: string;
|
|
36
|
+
zIndex?: number;
|
|
35
37
|
}>(),
|
|
36
|
-
{ buttonSize: 50 },
|
|
38
|
+
{ buttonSize: 50, zIndex: 1000 },
|
|
37
39
|
);
|
|
38
40
|
const sizeHalf = props.buttonSize / 2;
|
|
39
41
|
|
|
@@ -113,8 +115,7 @@ function onResize() {
|
|
|
113
115
|
}
|
|
114
116
|
timer = setTimeout(() => {
|
|
115
117
|
buttonPosition.transition = 'none';
|
|
116
|
-
|
|
117
|
-
uni.setStorageSync(DEV_BUTTON_INFO, {
|
|
118
|
+
setDevToolInfo({
|
|
118
119
|
left: buttonPosition.left,
|
|
119
120
|
top: buttonPosition.top,
|
|
120
121
|
});
|
|
@@ -122,19 +123,15 @@ function onResize() {
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
onMounted(() => {
|
|
125
|
-
const { left, top
|
|
126
|
-
|
|
127
|
-
top: '80vh',
|
|
128
|
-
};
|
|
126
|
+
const { left = windowWidth - props.buttonSize + 'px', top = '80vh' } =
|
|
127
|
+
getDevToolInfo();
|
|
129
128
|
buttonPosition.left = left;
|
|
130
129
|
buttonPosition.top = top;
|
|
131
130
|
});
|
|
132
131
|
|
|
133
132
|
onShow(() => {
|
|
134
|
-
const { left, top
|
|
135
|
-
|
|
136
|
-
top: '80vh',
|
|
137
|
-
};
|
|
133
|
+
const { left = windowWidth - props.buttonSize + 'px', top = '80vh' } =
|
|
134
|
+
getDevToolInfo();
|
|
138
135
|
buttonPosition.left = left;
|
|
139
136
|
buttonPosition.top = top;
|
|
140
137
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="dev-tool-title" :style="
|
|
2
|
+
<view class="dev-tool-title" :style="innerStyle"> <slot /> </view>
|
|
3
3
|
</template>
|
|
4
4
|
<script lang="ts" setup>
|
|
5
|
-
defineProps<{
|
|
5
|
+
defineProps<{ innerStyle?: any }>();
|
|
6
6
|
</script>
|
|
7
7
|
<style scoped>
|
|
8
8
|
.dev-tool-title {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
:sourceFileServers="sourceFileServers"
|
|
30
30
|
:mode="mode"
|
|
31
31
|
:useDevSource="useDevSource"
|
|
32
|
+
:zIndex="zIndex + 1"
|
|
32
33
|
v-model="searchConsole"
|
|
33
34
|
@choose="onConsoleChoose"
|
|
34
35
|
@search="onSearchConsole"
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
v-if="swiperShow(2)"
|
|
44
45
|
:currentNetworkType="currentNetworkType"
|
|
45
46
|
:networkList="networkList"
|
|
47
|
+
:zIndex="zIndex + 1"
|
|
46
48
|
v-model="searchNetwork"
|
|
47
49
|
@choose="onNetworkChoose"
|
|
48
50
|
@search="onSearchNetwork"
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
v-if="swiperShow(3)"
|
|
54
56
|
:currentUploadType="currentUploadType"
|
|
55
57
|
:uploadList="uploadList"
|
|
58
|
+
:zIndex="zIndex + 1"
|
|
56
59
|
v-model="searchUpload"
|
|
57
60
|
@choose="onUploadChoose"
|
|
58
61
|
@search="onSearchUpload"
|
|
@@ -63,6 +66,7 @@
|
|
|
63
66
|
v-if="swiperShow(4)"
|
|
64
67
|
:wsList="wsList"
|
|
65
68
|
:currentWebSocketType="currentWebSocketType"
|
|
69
|
+
:zIndex="zIndex + 1"
|
|
66
70
|
v-model="searchWs"
|
|
67
71
|
@choose="onWebSocketChoose"
|
|
68
72
|
@search="onSearchWs"
|
|
@@ -86,6 +90,7 @@
|
|
|
86
90
|
:mode="mode"
|
|
87
91
|
:useDevSource="useDevSource"
|
|
88
92
|
:sourceFileServers="sourceFileServers"
|
|
93
|
+
:zIndex="zIndex + 1"
|
|
89
94
|
@clear="onUniEventClear"
|
|
90
95
|
/>
|
|
91
96
|
</swiper-item>
|
|
@@ -191,7 +196,6 @@ import {
|
|
|
191
196
|
DEV_UPLOAD_CLEAR,
|
|
192
197
|
DEV_VUEX_CHANGE,
|
|
193
198
|
DEV_WEBSOCKET_CLEAR,
|
|
194
|
-
DEV_WINDOW_INFO,
|
|
195
199
|
DEV_APP_MESSAGE,
|
|
196
200
|
DEV_UNI_EVENT_CLEAR,
|
|
197
201
|
DEV_RUN_JS,
|
|
@@ -200,6 +204,7 @@ import {
|
|
|
200
204
|
import { debounce, hightLight } from '../../utils/index';
|
|
201
205
|
import type { DevTool } from '../../type';
|
|
202
206
|
import { eventBus } from '../../core';
|
|
207
|
+
import { getDevToolInfo, setDevToolInfo } from '../../devToolInfo';
|
|
203
208
|
|
|
204
209
|
const items = [
|
|
205
210
|
{
|
|
@@ -358,13 +363,19 @@ const searchWs = ref('');
|
|
|
358
363
|
const searchRoute = ref('');
|
|
359
364
|
const searchStorage = ref('');
|
|
360
365
|
|
|
361
|
-
const props =
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
366
|
+
const props = withDefaults(
|
|
367
|
+
defineProps<{
|
|
368
|
+
open?: boolean;
|
|
369
|
+
data?: DevTool.WindowData;
|
|
370
|
+
sourceFileServers?: string[];
|
|
371
|
+
mode?: string;
|
|
372
|
+
useDevSource?: boolean;
|
|
373
|
+
zIndex?: number;
|
|
374
|
+
}>(),
|
|
375
|
+
{
|
|
376
|
+
zIndex: 1000,
|
|
377
|
+
},
|
|
378
|
+
);
|
|
368
379
|
|
|
369
380
|
const emits = defineEmits<{
|
|
370
381
|
(e: 'close'): void;
|
|
@@ -555,12 +566,13 @@ const listenPostMessage = (data: DevTool.WindowData) => {
|
|
|
555
566
|
|
|
556
567
|
let isActive = false;
|
|
557
568
|
onMounted(() => {
|
|
558
|
-
const
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
569
|
+
const devToolInfo = getDevToolInfo();
|
|
570
|
+
|
|
571
|
+
if (devToolInfo) {
|
|
572
|
+
activeTab.value = devToolInfo?.activeTab || 0;
|
|
573
|
+
currentConsoleType.value = devToolInfo?.currentConsoleType || 'all';
|
|
574
|
+
currentNetworkType.value = devToolInfo?.currentNetworkType || 'all';
|
|
575
|
+
tabScrollLeft.value = devToolInfo?.tabScrollLeft || 0;
|
|
564
576
|
}
|
|
565
577
|
if (props.data) {
|
|
566
578
|
listenPostMessage(props.data);
|
|
@@ -581,6 +593,10 @@ onShow(() => {
|
|
|
581
593
|
});
|
|
582
594
|
onHide(() => {
|
|
583
595
|
isActive = false;
|
|
596
|
+
|
|
597
|
+
setDevToolInfo({
|
|
598
|
+
devToolWindowVisible: false,
|
|
599
|
+
});
|
|
584
600
|
});
|
|
585
601
|
|
|
586
602
|
/** 发送消息给 uniapp */
|
|
@@ -592,7 +608,7 @@ function basicSendMessage(message: {
|
|
|
592
608
|
}
|
|
593
609
|
|
|
594
610
|
function setWindowInfo() {
|
|
595
|
-
|
|
611
|
+
setDevToolInfo({
|
|
596
612
|
activeTab: activeTab.value,
|
|
597
613
|
currentConsoleType: currentConsoleType.value,
|
|
598
614
|
currentNetworkType: currentNetworkType.value,
|
|
@@ -990,7 +1006,7 @@ function onChangePinia(value: Record<string, any>) {
|
|
|
990
1006
|
position: fixed;
|
|
991
1007
|
top: 0;
|
|
992
1008
|
left: 0;
|
|
993
|
-
z-index:
|
|
1009
|
+
z-index: 1001;
|
|
994
1010
|
/* #ifdef H5 */
|
|
995
1011
|
padding: 50px 0;
|
|
996
1012
|
/* #endif */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="network-detail">
|
|
2
|
+
<view class="network-detail" :style="{ zIndex: zIndex }">
|
|
3
3
|
<view class="network-detail-control">
|
|
4
4
|
<Tag
|
|
5
5
|
mode="info"
|
|
@@ -81,7 +81,7 @@ import Tag from '../Tag/index.vue';
|
|
|
81
81
|
import Empty from '../Empty/index.vue';
|
|
82
82
|
import CloseButton from '../CloseButton/index.vue';
|
|
83
83
|
import type { DevTool } from '../../type';
|
|
84
|
-
const props = defineProps<{ network: DevTool.NetworkItem }>();
|
|
84
|
+
const props = defineProps<{ network: DevTool.NetworkItem; zIndex?: number }>();
|
|
85
85
|
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
86
86
|
const selectItems = [
|
|
87
87
|
{
|
|
@@ -151,13 +151,10 @@ function onClose() {
|
|
|
151
151
|
position: fixed;
|
|
152
152
|
width: 100vw;
|
|
153
153
|
height: 100vh;
|
|
154
|
-
z-index:
|
|
154
|
+
z-index: 1001;
|
|
155
155
|
top: 0;
|
|
156
156
|
left: 0;
|
|
157
157
|
padding: 0 16px;
|
|
158
|
-
/* #ifdef H5 */
|
|
159
|
-
padding: 50px 16px;
|
|
160
|
-
/* #endif */
|
|
161
158
|
|
|
162
159
|
background-color: rgba(255, 255, 255, 0.95);
|
|
163
160
|
box-sizing: border-box;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<view class="network-url-row">
|
|
4
4
|
<Tag mode="info">{{ network.method }}</Tag>
|
|
5
5
|
|
|
6
|
-
<view class="network-url" v-html="
|
|
6
|
+
<view class="network-url" v-html="lastUrl"> </view>
|
|
7
7
|
|
|
8
8
|
<Tag
|
|
9
9
|
mode="main"
|
|
@@ -46,20 +46,32 @@
|
|
|
46
46
|
</view>
|
|
47
47
|
</view>
|
|
48
48
|
<!-- <Transition name="slide-fade"> -->
|
|
49
|
-
<NetworkDetail
|
|
49
|
+
<NetworkDetail
|
|
50
|
+
v-if="showDetail"
|
|
51
|
+
:network="network"
|
|
52
|
+
:zIndex="zIndex"
|
|
53
|
+
@close="onClose"
|
|
54
|
+
/>
|
|
50
55
|
<!-- </Transition> -->
|
|
51
56
|
</template>
|
|
52
57
|
|
|
53
58
|
<script lang="ts" setup>
|
|
54
|
-
import { ref } from 'vue';
|
|
59
|
+
import { computed, ref } from 'vue';
|
|
55
60
|
import Tag from '../Tag/index.vue';
|
|
56
61
|
import NetworkDetail from './NetworkDetail.vue';
|
|
57
62
|
import { formatDate } from '../../utils';
|
|
58
63
|
import type { DevTool } from '../../type';
|
|
59
|
-
defineProps<{
|
|
64
|
+
const props = defineProps<{
|
|
60
65
|
network: DevTool.NetworkItem;
|
|
66
|
+
zIndex?: number;
|
|
61
67
|
}>();
|
|
62
68
|
const showDetail = ref(false);
|
|
69
|
+
|
|
70
|
+
const lastUrl = computed(() => {
|
|
71
|
+
const start = props.network.url.lastIndexOf('/');
|
|
72
|
+
return props.network.url.slice(start + 1);
|
|
73
|
+
});
|
|
74
|
+
|
|
63
75
|
function onClose() {
|
|
64
76
|
showDetail.value = false;
|
|
65
77
|
}
|
|
@@ -70,22 +82,23 @@ function onClose() {
|
|
|
70
82
|
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
71
83
|
font-size: var(--dev-tool-base-font-size);
|
|
72
84
|
}
|
|
73
|
-
.network-
|
|
85
|
+
.network-url-row {
|
|
74
86
|
display: flex;
|
|
75
87
|
align-items: center;
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
.network-
|
|
90
|
+
.network-url {
|
|
79
91
|
margin-left: 4px;
|
|
80
92
|
flex: 1;
|
|
93
|
+
white-space: nowrap;
|
|
81
94
|
overflow: hidden;
|
|
82
95
|
text-overflow: ellipsis;
|
|
83
96
|
}
|
|
84
|
-
.network-
|
|
97
|
+
.network-detail-icon {
|
|
85
98
|
margin-left: auto;
|
|
86
99
|
}
|
|
87
100
|
|
|
88
|
-
.network-
|
|
101
|
+
.network-info {
|
|
89
102
|
display: flex;
|
|
90
103
|
align-items: center;
|
|
91
104
|
justify-content: space-between;
|