vite-uni-dev-tool 0.0.13 → 0.0.15
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/core.js +1 -1
- package/dist/devIntercept/index.d.ts +3 -3
- package/dist/devIntercept/index.d.ts.map +1 -1
- package/dist/devIntercept/index.js +117 -114
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts +32 -0
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformApp.js +32 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts +26 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformMain.js +3 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +41 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformVue.js +9 -0
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +7 -3
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -33
- package/dist/plugins/utils/index.d.ts +32 -0
- package/dist/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +1 -1
- package/dist/type.d.ts +2 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/v2/AppInfo/index.vue +41 -0
- package/dist/v2/AutoSizer/index.vue +189 -0
- package/dist/v2/AutoSizer/index1.vue +193 -0
- package/dist/v2/AutoSizer/utils.ts +49 -0
- package/dist/v2/CaptureScreen/index.vue +78 -0
- package/dist/v2/CloseButton/index.vue +32 -0
- package/dist/v2/Connection/index.vue +94 -0
- package/dist/v2/ConsoleList/ConsoleItem.vue +235 -0
- package/dist/v2/ConsoleList/RunJSInput.vue +243 -0
- package/dist/v2/ConsoleList/index.vue +164 -0
- package/dist/v2/ConsoleList/staticTips.js +1144 -0
- package/dist/v2/DevTool/index.vue +162 -0
- package/dist/v2/DevToolButton/index.vue +228 -0
- package/dist/v2/DevToolTitle/index.vue +28 -0
- package/dist/v2/DevToolWindow/index.vue +1051 -0
- package/dist/v2/DeviceInfo/index.vue +48 -0
- package/dist/v2/Empty/empty.png +0 -0
- package/dist/v2/Empty/index.vue +40 -0
- package/dist/v2/FilterInput/index.vue +100 -0
- package/dist/v2/JsonPretty/components/Brackets/index.vue +30 -0
- package/dist/v2/JsonPretty/components/Carets/index.vue +65 -0
- package/dist/v2/JsonPretty/components/CheckController/index.vue +127 -0
- package/dist/v2/JsonPretty/components/TreeNode/index.vue +417 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.ts +21 -0
- package/dist/v2/JsonPretty/hooks/useError.ts +21 -0
- package/dist/v2/JsonPretty/index.vue +531 -0
- package/dist/v2/JsonPretty/type.ts +125 -0
- package/dist/v2/JsonPretty/utils/index.js +211 -0
- package/dist/v2/NetworkList/NetworkDetail.vue +215 -0
- package/dist/v2/NetworkList/NetworkItem.vue +135 -0
- package/dist/v2/NetworkList/index.vue +148 -0
- package/dist/v2/PiniaList/index.vue +79 -0
- package/dist/v2/RouteList/index.vue +137 -0
- package/dist/v2/RunJS/index.vue +128 -0
- package/dist/v2/SettingList/index.vue +318 -0
- package/dist/v2/SourceCode/index.vue +237 -0
- package/dist/v2/StorageList/index.vue +165 -0
- package/dist/v2/SystemInfo/index.vue +49 -0
- package/dist/v2/Tabs/index.vue +127 -0
- package/dist/v2/Tag/index.vue +91 -0
- package/dist/v2/UniEvent/UniEventItem.vue +157 -0
- package/dist/v2/UniEvent/index.vue +127 -0
- package/dist/v2/UploadList/UploadDetail.vue +204 -0
- package/dist/v2/UploadList/UploadItem.vue +134 -0
- package/dist/v2/UploadList/index.vue +143 -0
- package/dist/v2/VirtualList/index.vue +140 -0
- package/dist/v2/VirtualListPro/AutoSize.vue +50 -0
- package/dist/v2/VirtualListPro/index.vue +255 -0
- package/dist/v2/VirtualListPro/readme.md +40 -0
- package/dist/v2/VuexList/index.vue +80 -0
- package/dist/v2/WebSocket/WebSocketItem.vue +129 -0
- package/dist/v2/WebSocket/WebSocketList.vue +183 -0
- package/dist/v2/WebSocket/index.vue +155 -0
- package/dist/v2/WindowInfo/index.vue +49 -0
- package/dist/v3/AppInfo/index.vue +35 -0
- package/dist/v3/AutoSizer/index.vue +193 -0
- package/dist/v3/AutoSizer/index1.vue +186 -0
- package/dist/v3/AutoSizer/utils.ts +49 -0
- package/dist/v3/CaptureScreen/index.vue +62 -0
- package/dist/v3/CloseButton/index.vue +29 -0
- package/dist/v3/Connection/index.vue +88 -0
- package/dist/v3/ConsoleList/ConsoleItem.vue +208 -0
- package/dist/v3/ConsoleList/RunJSInput.vue +240 -0
- package/dist/v3/ConsoleList/index.vue +139 -0
- package/dist/v3/ConsoleList/staticTips.ts +1145 -0
- package/dist/v3/DevTool/index.vue +217 -0
- package/dist/v3/DevToolButton/index.vue +210 -0
- package/dist/v3/DevToolTitle/index.vue +21 -0
- package/dist/v3/DevToolWindow/index.vue +1116 -0
- package/dist/v3/DeviceInfo/index.vue +32 -0
- package/dist/v3/Empty/empty.png +0 -0
- package/dist/v3/Empty/index.vue +28 -0
- package/dist/v3/FilterInput/index.vue +87 -0
- package/dist/v3/JsonPretty/components/Brackets/index.vue +23 -0
- package/dist/v3/JsonPretty/components/Carets/index.vue +59 -0
- package/dist/v3/JsonPretty/components/CheckController/index.vue +125 -0
- package/dist/v3/JsonPretty/components/TreeNode/index.vue +349 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.ts +21 -0
- package/dist/v3/JsonPretty/hooks/useError.ts +21 -0
- package/dist/v3/JsonPretty/index.vue +476 -0
- package/dist/v3/JsonPretty/type.ts +125 -0
- package/dist/v3/JsonPretty/utils/index.ts +172 -0
- package/dist/v3/NetworkList/NetworkDetail.vue +194 -0
- package/dist/v3/NetworkList/NetworkItem.vue +120 -0
- package/dist/v3/NetworkList/index.vue +128 -0
- package/dist/v3/PiniaList/index.vue +64 -0
- package/dist/v3/RouteList/index.vue +121 -0
- package/dist/v3/RunJS/index.vue +128 -0
- package/dist/v3/SettingList/index.vue +313 -0
- package/dist/v3/SourceCode/index.vue +231 -0
- package/dist/v3/StorageList/index.vue +170 -0
- package/dist/v3/SystemInfo/index.vue +34 -0
- package/dist/v3/Tabs/index.vue +123 -0
- package/dist/v3/Tag/index.vue +89 -0
- package/dist/v3/UniEvent/UniEventItem.vue +126 -0
- package/dist/v3/UniEvent/index.vue +98 -0
- package/dist/v3/UploadList/UploadDetail.vue +192 -0
- package/dist/v3/UploadList/UploadItem.vue +117 -0
- package/dist/v3/UploadList/index.vue +117 -0
- package/dist/v3/VirtualList/index.vue +112 -0
- package/dist/v3/VirtualListPro/AutoSize.vue +43 -0
- package/dist/v3/VirtualListPro/index.vue +238 -0
- package/dist/v3/VirtualListPro/readme.md +40 -0
- package/dist/v3/VuexList/index.vue +54 -0
- package/dist/v3/WebSocket/WebSocketItem.vue +103 -0
- package/dist/v3/WebSocket/WebSocketList.vue +161 -0
- package/dist/v3/WebSocket/index.vue +124 -0
- package/dist/v3/WindowInfo/index.vue +33 -0
- package/package.json +1 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="dev-tool-code" :style="{ zIndex: zIndex }">
|
|
3
|
+
<view class="dev-tool-code-control">
|
|
4
|
+
<FilterInput
|
|
5
|
+
v-model="modelValue"
|
|
6
|
+
style="width: 100%"
|
|
7
|
+
@search="onSearch"
|
|
8
|
+
/>
|
|
9
|
+
<CloseButton style="margin-left: auto" @click="onClose" />
|
|
10
|
+
</view>
|
|
11
|
+
<view class="dev-tool-code-title">{{ fileName }}</view>
|
|
12
|
+
<scroll-view
|
|
13
|
+
scroll-y="true"
|
|
14
|
+
scroll-x="true"
|
|
15
|
+
class="dev-tool-code-list"
|
|
16
|
+
scroll-with-animation="true"
|
|
17
|
+
:scroll-top="scrollTop"
|
|
18
|
+
:scroll-into-view="scrollIntoView"
|
|
19
|
+
>
|
|
20
|
+
<view
|
|
21
|
+
v-for="(code, index) in codes"
|
|
22
|
+
:id="`dev-tool-code-item-${index}`"
|
|
23
|
+
:key="index"
|
|
24
|
+
:class="`dev-tool-code-item ${index === activeRowCol.activeRow ? 'dev-tool-code-item-active' : ''}`"
|
|
25
|
+
>
|
|
26
|
+
<view class="dev-tool-code-item-index">
|
|
27
|
+
{{ start + index + 1 }}
|
|
28
|
+
</view>
|
|
29
|
+
|
|
30
|
+
<view class="dev-tool-code-item-content" v-html="code"></view>
|
|
31
|
+
</view>
|
|
32
|
+
<Empty v-if="!codes || codes.length === 0" />
|
|
33
|
+
</scroll-view>
|
|
34
|
+
</view>
|
|
35
|
+
</template>
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { computed, ref, nextTick, onMounted } from 'vue';
|
|
38
|
+
import FilterInput from '../FilterInput/index.vue';
|
|
39
|
+
import CloseButton from '../CloseButton/index.vue';
|
|
40
|
+
import Empty from '../Empty/index.vue';
|
|
41
|
+
import { escapeHTML, hightLight, isAndroid, parseStock } from '../../utils';
|
|
42
|
+
|
|
43
|
+
const props = defineProps<{
|
|
44
|
+
url: string;
|
|
45
|
+
sourceFileServers?: string[];
|
|
46
|
+
mode?: string;
|
|
47
|
+
zIndex?: number;
|
|
48
|
+
}>();
|
|
49
|
+
|
|
50
|
+
const emit = defineEmits<{ (e: 'close'): void }>();
|
|
51
|
+
|
|
52
|
+
const modelValue = ref('');
|
|
53
|
+
const scrollTop = ref(0);
|
|
54
|
+
const fileName = computed(() => {
|
|
55
|
+
const name =
|
|
56
|
+
props?.url?.split('/')?.pop()?.replace(/\)|\(/, '') ?? '文件名称未知';
|
|
57
|
+
return name;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const activeRowCol = ref({ row: -1, col: -1, activeRow: -1 });
|
|
61
|
+
|
|
62
|
+
let backupCodes: string[] = [];
|
|
63
|
+
|
|
64
|
+
const codes = ref<string[]>([]);
|
|
65
|
+
|
|
66
|
+
const scrollIntoView = ref('');
|
|
67
|
+
|
|
68
|
+
const start = computed(() => {
|
|
69
|
+
return activeRowCol.value.row - 20 > 0 ? activeRowCol.value.row - 20 : 0;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function onClose() {
|
|
73
|
+
emit('close');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function onSearch(value: string) {
|
|
77
|
+
codes.value = backupCodes.map((code) => {
|
|
78
|
+
return hightLight(code, value);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
let index = 0;
|
|
83
|
+
function getCode(url: string, i: number = 0) {
|
|
84
|
+
let allUrl = url;
|
|
85
|
+
// 平台判断
|
|
86
|
+
if (isAndroid()) {
|
|
87
|
+
if (!props.sourceFileServers?.[i]) {
|
|
88
|
+
index = 0;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
allUrl = props.sourceFileServers?.[i] + '/src/' + url;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
uni.showLoading({ mask: true });
|
|
96
|
+
uni.request({
|
|
97
|
+
url: allUrl,
|
|
98
|
+
success: (res) => {
|
|
99
|
+
if (typeof res.data === 'string') {
|
|
100
|
+
// 为什么要注释掉?
|
|
101
|
+
// 在 Android 识别到标签后会进行重启,导致代码无法显示
|
|
102
|
+
// TODO: 还有其它原因导致重启
|
|
103
|
+
const str = res.data
|
|
104
|
+
?.replace(/<jscript/, '// [DevTool] 注释 <javascript')
|
|
105
|
+
?.replace(/<\/script>/, '// [DevTool] 注释 </javascript>')
|
|
106
|
+
?.replace(/<style/, '// [DevTool] 注释 <style')
|
|
107
|
+
?.replace(/<\/style>/, '// [DevTool] 注释 </style>');
|
|
108
|
+
backupCodes = escapeHTML(str ?? '')
|
|
109
|
+
.toString()
|
|
110
|
+
.split('\n');
|
|
111
|
+
|
|
112
|
+
const start =
|
|
113
|
+
activeRowCol.value.row - 20 > 0 ? activeRowCol.value.row - 20 : 0;
|
|
114
|
+
|
|
115
|
+
const end =
|
|
116
|
+
activeRowCol.value.row + 20 > backupCodes.length
|
|
117
|
+
? backupCodes.length
|
|
118
|
+
: activeRowCol.value.row + 20;
|
|
119
|
+
|
|
120
|
+
// backupCodes.slice(start, end);
|
|
121
|
+
|
|
122
|
+
codes.value = backupCodes.slice(start, end);
|
|
123
|
+
|
|
124
|
+
activeRowCol.value.activeRow = activeRowCol.value.row - start;
|
|
125
|
+
|
|
126
|
+
nextTick(() => {
|
|
127
|
+
scrollIntoView.value = `dev-tool-code-item-${activeRowCol.value.activeRow}`;
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
fail: (err) => {
|
|
132
|
+
index++;
|
|
133
|
+
getCode(url, index);
|
|
134
|
+
uni.showToast({ icon: 'none', title: '正在重新尝试中...' });
|
|
135
|
+
},
|
|
136
|
+
complete: () => {
|
|
137
|
+
uni.hideLoading();
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** 开发环境获取源代码 */
|
|
143
|
+
function getSourceCodeDev(url: string) {
|
|
144
|
+
if (!url) {
|
|
145
|
+
uni.showToast({ icon: 'none', title: '[DevTool] url 处理异常' });
|
|
146
|
+
uni?.__dev__console?.log('[DevTool] url 处理异常');
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
getCode(url, index);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
onMounted(() => {
|
|
154
|
+
let url = props?.url;
|
|
155
|
+
|
|
156
|
+
const { path, col, row } = parseStock(props?.url ?? '');
|
|
157
|
+
|
|
158
|
+
if (path) {
|
|
159
|
+
url = path;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
activeRowCol.value.col = col;
|
|
163
|
+
activeRowCol.value.row = row;
|
|
164
|
+
|
|
165
|
+
if (props.mode === 'development') {
|
|
166
|
+
// 开发环境查看源码
|
|
167
|
+
getSourceCodeDev(url);
|
|
168
|
+
} else if (props.mode === 'production') {
|
|
169
|
+
// TODO 生产环境查看源码
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
<style scoped>
|
|
174
|
+
.dev-tool-code {
|
|
175
|
+
position: fixed;
|
|
176
|
+
width: 100vw;
|
|
177
|
+
height: 100vh;
|
|
178
|
+
z-index: 1001;
|
|
179
|
+
top: 0;
|
|
180
|
+
left: 0;
|
|
181
|
+
padding: 0 16px;
|
|
182
|
+
|
|
183
|
+
background-color: var(--dev-tool-bg2-color);
|
|
184
|
+
box-sizing: border-box;
|
|
185
|
+
color: var(--dev-tool-text-color);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.dev-tool-code-control {
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
gap: 12px;
|
|
192
|
+
height: 32px;
|
|
193
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
194
|
+
box-sizing: border-box;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.dev-tool-code-title {
|
|
198
|
+
height: 32px;
|
|
199
|
+
line-height: 32px;
|
|
200
|
+
margin-bottom: 4px;
|
|
201
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
202
|
+
box-sizing: border-box;
|
|
203
|
+
white-space: nowrap;
|
|
204
|
+
overflow: auto;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.dev-tool-code-list {
|
|
208
|
+
height: calc(100% - 68px);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.dev-tool-code-item {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
height: 28px;
|
|
215
|
+
}
|
|
216
|
+
.dev-tool-code-item-active {
|
|
217
|
+
color: #fff;
|
|
218
|
+
background-color: var(--dev-tool-main-color);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.dev-tool-code-item-index {
|
|
222
|
+
flex-shrink: 0;
|
|
223
|
+
width: 20px;
|
|
224
|
+
margin-right: 8px;
|
|
225
|
+
text-align: right;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.dev-tool-code-item-content {
|
|
229
|
+
white-space: pre;
|
|
230
|
+
}
|
|
231
|
+
</style>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="storage-content">
|
|
3
|
+
<view class="storage-control">
|
|
4
|
+
<FilterInput
|
|
5
|
+
:modelValue="modelValue"
|
|
6
|
+
style="width: 100%"
|
|
7
|
+
placeholder="查询key"
|
|
8
|
+
@search="emit('search', $event)"
|
|
9
|
+
@update:modelValue="emit('update:modelValue', $event)"
|
|
10
|
+
/>
|
|
11
|
+
<Tag
|
|
12
|
+
v-for="item in storageFilerItem"
|
|
13
|
+
mode="clear"
|
|
14
|
+
:key="item.label"
|
|
15
|
+
@click="onChoose(item.value)"
|
|
16
|
+
>
|
|
17
|
+
{{ item.label }}
|
|
18
|
+
</Tag>
|
|
19
|
+
</view>
|
|
20
|
+
<view class="storage-list">
|
|
21
|
+
<view class="storage-item" v-for="item in storageList" :key="item.key">
|
|
22
|
+
<view class="storage-key">
|
|
23
|
+
<view class="storage-key-label">
|
|
24
|
+
<view>key: </view>
|
|
25
|
+
<view v-html="item._oldKey" />
|
|
26
|
+
</view>
|
|
27
|
+
<CloseButton style="margin-left: auto" @click="onRemove(item.key)" />
|
|
28
|
+
</view>
|
|
29
|
+
|
|
30
|
+
<JsonPretty
|
|
31
|
+
:data="{
|
|
32
|
+
key: item.key,
|
|
33
|
+
value: item.value,
|
|
34
|
+
}"
|
|
35
|
+
showLength
|
|
36
|
+
editable
|
|
37
|
+
@update:data="onUpdateData($event, item)"
|
|
38
|
+
/>
|
|
39
|
+
</view>
|
|
40
|
+
<Empty v-if="!storageList || storageList.length === 0" />
|
|
41
|
+
</view>
|
|
42
|
+
</view>
|
|
43
|
+
</template>
|
|
44
|
+
<script lang="ts" setup>
|
|
45
|
+
import Tag from '../Tag/index.vue';
|
|
46
|
+
import JsonPretty from '../JsonPretty/index.vue';
|
|
47
|
+
import Empty from '../Empty/index.vue';
|
|
48
|
+
import CloseButton from '../CloseButton/index.vue';
|
|
49
|
+
import FilterInput from '../FilterInput/index.vue';
|
|
50
|
+
import type { DevTool } from '../../type';
|
|
51
|
+
const props = defineProps<{
|
|
52
|
+
storageList: DevTool.StorageItem[];
|
|
53
|
+
modelValue: string;
|
|
54
|
+
}>();
|
|
55
|
+
|
|
56
|
+
const emit = defineEmits<{
|
|
57
|
+
(e: 'choose', type: string): void;
|
|
58
|
+
(e: 'remove', key: string): void;
|
|
59
|
+
(e: 'update:storageList', data: Record<string, any>): void;
|
|
60
|
+
(e: 'diffValue', value: any): void;
|
|
61
|
+
(e: 'update:modelValue', value: string): void;
|
|
62
|
+
(e: 'search', value: string): void;
|
|
63
|
+
}>();
|
|
64
|
+
|
|
65
|
+
function onUpdateData(
|
|
66
|
+
data: DevTool.StorageItem,
|
|
67
|
+
item: DevTool.StorageItem,
|
|
68
|
+
) {
|
|
69
|
+
const tempList = JSON.parse(JSON.stringify(props.storageList));
|
|
70
|
+
const index = props.storageList.findIndex(
|
|
71
|
+
(store) => store.key === item._oldKey,
|
|
72
|
+
);
|
|
73
|
+
if (index === -1) return;
|
|
74
|
+
tempList[index] = {
|
|
75
|
+
key: data.key,
|
|
76
|
+
_oldKey: tempList[index]._oldKey,
|
|
77
|
+
value: data.value,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
emit('update:storageList', tempList);
|
|
81
|
+
emit('diffValue', {
|
|
82
|
+
...data,
|
|
83
|
+
_oldKey: tempList[index]._oldKey,
|
|
84
|
+
key: data.key,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const storageFilerItem = [
|
|
89
|
+
{
|
|
90
|
+
label: '新增',
|
|
91
|
+
value: 'add',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: '刷新',
|
|
95
|
+
value: 'refresh',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: '清除',
|
|
99
|
+
value: 'clear',
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
function calcValue(value: string) {
|
|
103
|
+
try {
|
|
104
|
+
return {
|
|
105
|
+
value: JSON.parse(value),
|
|
106
|
+
type: 'object',
|
|
107
|
+
};
|
|
108
|
+
} catch (error) {
|
|
109
|
+
return {
|
|
110
|
+
value,
|
|
111
|
+
type: 'string',
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function onChoose(type: string) {
|
|
116
|
+
emit('choose', type);
|
|
117
|
+
}
|
|
118
|
+
function onRemove(key: string) {
|
|
119
|
+
emit('remove', key);
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
122
|
+
<style scoped>
|
|
123
|
+
.storage-content {
|
|
124
|
+
height: 100%;
|
|
125
|
+
font-size: var(--dev-tool-base-font-size);
|
|
126
|
+
}
|
|
127
|
+
.storage-content .storage-list {
|
|
128
|
+
height: calc(100% - 32px);
|
|
129
|
+
overflow: auto;
|
|
130
|
+
}
|
|
131
|
+
.storage-content .storage-list .storage-item {
|
|
132
|
+
padding: 16px;
|
|
133
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
134
|
+
}
|
|
135
|
+
.storage-content .storage-list .storage-item .storage-key {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: space-between;
|
|
139
|
+
word-break: break-all;
|
|
140
|
+
}
|
|
141
|
+
.storage-key-label {
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
}
|
|
145
|
+
.storage-content .storage-list .storage-item .storage-value {
|
|
146
|
+
word-break: break-all;
|
|
147
|
+
}
|
|
148
|
+
.storage-content .storage-list .storage-item .storage-remove {
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
width: 24px;
|
|
154
|
+
height: 24px;
|
|
155
|
+
margin: auto 0 auto 16px;
|
|
156
|
+
border-radius: 50%;
|
|
157
|
+
border: 1px solid #000;
|
|
158
|
+
box-sizing: border-box;
|
|
159
|
+
}
|
|
160
|
+
.storage-control {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: flex-end;
|
|
164
|
+
gap: 8px;
|
|
165
|
+
padding: 0 16px;
|
|
166
|
+
height: 32px;
|
|
167
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
168
|
+
box-sizing: border-box;
|
|
169
|
+
}
|
|
170
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="system-content">
|
|
3
|
+
<JsonPretty :data="systemInfo" showLength v-if="showJson" />
|
|
4
|
+
<Empty v-else />
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { computed } from 'vue';
|
|
9
|
+
import JsonPretty from '../JsonPretty/index.vue';
|
|
10
|
+
import Empty from '../Empty/index.vue';
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
systemInfo: Record<string, any>;
|
|
13
|
+
}>();
|
|
14
|
+
const showJson = computed(() => {
|
|
15
|
+
try {
|
|
16
|
+
const str = JSON.stringify(props.systemInfo);
|
|
17
|
+
if (typeof props.systemInfo === 'object' && (str === '' || str === '{}')) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
</script>
|
|
26
|
+
<style scoped>
|
|
27
|
+
.system-content {
|
|
28
|
+
padding: 16px;
|
|
29
|
+
font-size: var(--dev-tool-base-font-size);
|
|
30
|
+
|
|
31
|
+
height: calc(100% - 32px);
|
|
32
|
+
overflow: auto;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="tabs">
|
|
3
|
+
<scroll-view
|
|
4
|
+
class="tabs-list"
|
|
5
|
+
ref="tabsRef"
|
|
6
|
+
scroll-x="true"
|
|
7
|
+
enable-flex="true"
|
|
8
|
+
scroll-with-animation
|
|
9
|
+
:scrollLeft="scrollLeft"
|
|
10
|
+
:scroll-into-view="scrollIntoView"
|
|
11
|
+
@scroll="onScroll"
|
|
12
|
+
>
|
|
13
|
+
<view
|
|
14
|
+
v-for="item in items"
|
|
15
|
+
:key="item.key"
|
|
16
|
+
:class="`tabs-item ${
|
|
17
|
+
item.index === modelValue ? 'tabs-item-active' : ''
|
|
18
|
+
} `"
|
|
19
|
+
:id="`tabs-item-${item.index}`"
|
|
20
|
+
@click="onChangeTabs(item)"
|
|
21
|
+
>
|
|
22
|
+
{{ item.label }}
|
|
23
|
+
</view>
|
|
24
|
+
</scroll-view>
|
|
25
|
+
<view class="tabs-extra">
|
|
26
|
+
<slot name="extra"></slot>
|
|
27
|
+
<CloseButton style="margin: 0 16px" @click="onClose" />
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script setup lang="ts">
|
|
33
|
+
import { computed, ref } from 'vue';
|
|
34
|
+
import CloseButton from '../CloseButton/index.vue';
|
|
35
|
+
// const activeKey = ref("Console");
|
|
36
|
+
const props = defineProps<{
|
|
37
|
+
modelValue: number;
|
|
38
|
+
items: { label: string; key: string; value: any; index: number }[];
|
|
39
|
+
scrollLeft?: number;
|
|
40
|
+
}>();
|
|
41
|
+
|
|
42
|
+
const tabsRef = ref();
|
|
43
|
+
|
|
44
|
+
const emit = defineEmits<{
|
|
45
|
+
(e: 'close'): void;
|
|
46
|
+
(e: 'update:modelValue', value: number): void;
|
|
47
|
+
(e: 'change', value: number): void;
|
|
48
|
+
(e: 'scroll', value: any): void;
|
|
49
|
+
}>();
|
|
50
|
+
|
|
51
|
+
const scrollIntoView = computed(() => {
|
|
52
|
+
return `tabs-item-${props.modelValue}`;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
function onChangeTabs(item: {
|
|
56
|
+
label: string;
|
|
57
|
+
key: string;
|
|
58
|
+
value: any;
|
|
59
|
+
index: number;
|
|
60
|
+
}) {
|
|
61
|
+
// activeKey.value = item.key;
|
|
62
|
+
emit('update:modelValue', item.index);
|
|
63
|
+
emit('change', item.index);
|
|
64
|
+
}
|
|
65
|
+
function onClose() {
|
|
66
|
+
emit('close');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onScroll(e: any) {
|
|
70
|
+
emit('scroll', e);
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style scoped>
|
|
75
|
+
.tabs {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
height: 32px;
|
|
79
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
font-size: var(--dev-tool-base-font-size);
|
|
82
|
+
}
|
|
83
|
+
.tabs .tabs-list {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
flex: 1;
|
|
87
|
+
overflow: auto;
|
|
88
|
+
-ms-overflow-style: none;
|
|
89
|
+
scrollbar-width: none;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
.tabs-list ::-webkit-scrollbar {
|
|
94
|
+
display: none;
|
|
95
|
+
width: 0;
|
|
96
|
+
height: 0;
|
|
97
|
+
background-color: transparent;
|
|
98
|
+
}
|
|
99
|
+
.tabs-list ::-webkit-scrollbar-thumb {
|
|
100
|
+
width: 0;
|
|
101
|
+
height: 0;
|
|
102
|
+
background-color: transparent;
|
|
103
|
+
}
|
|
104
|
+
.tabs .tabs-item {
|
|
105
|
+
display: inline-block;
|
|
106
|
+
padding: 0 16px;
|
|
107
|
+
height: 32px;
|
|
108
|
+
line-height: 32px;
|
|
109
|
+
border-bottom: 1px solid transparent;
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
transition: all 0.3s;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
114
|
+
.tabs .tabs-item-active {
|
|
115
|
+
color: var(--dev-tool-main-color);
|
|
116
|
+
border-color: var(--dev-tool-main-color);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.tabs-extra {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
}
|
|
123
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="`tag tag-${mode} ${active ? 'tag-active' : ''}`"
|
|
4
|
+
@click="onClick"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</view>
|
|
8
|
+
</template>
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
defineProps<{
|
|
11
|
+
mode:
|
|
12
|
+
| 'primary'
|
|
13
|
+
| 'warn'
|
|
14
|
+
| 'success'
|
|
15
|
+
| 'error'
|
|
16
|
+
| 'info'
|
|
17
|
+
| 'log'
|
|
18
|
+
| 'main'
|
|
19
|
+
| 'clear'
|
|
20
|
+
| string;
|
|
21
|
+
active?: boolean;
|
|
22
|
+
}>();
|
|
23
|
+
const emit = defineEmits<{ (e: 'click', event: MouseEvent): void }>();
|
|
24
|
+
function onClick(event: MouseEvent) {
|
|
25
|
+
emit('click', event);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
<style scoped>
|
|
29
|
+
.tag {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
padding: 0 4px;
|
|
33
|
+
width: min-content;
|
|
34
|
+
height: 24px;
|
|
35
|
+
color: var(--dev-tool-text-color);
|
|
36
|
+
border-radius: 4px;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
font-size: var(--dev-tool-tag-font-size);
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
transition: all 0.3s;
|
|
42
|
+
}
|
|
43
|
+
.tag-log {
|
|
44
|
+
color: #000;
|
|
45
|
+
background-color: var(--dev-tool-log-color);
|
|
46
|
+
border: 1px solid var(--dev-tool-log-color);
|
|
47
|
+
}
|
|
48
|
+
.tag-info {
|
|
49
|
+
color: #000;
|
|
50
|
+
background-color: var(--dev-tool-normal-bg-color);
|
|
51
|
+
border: 1px solid var(--dev-tool-normal-bg-color);
|
|
52
|
+
}
|
|
53
|
+
.tag-warn {
|
|
54
|
+
background-color: var(--dev-tool-warn-color);
|
|
55
|
+
border: 1px solid var(--dev-tool-warn-color);
|
|
56
|
+
}
|
|
57
|
+
.tag-success {
|
|
58
|
+
background-color: var(--dev-tool-success-color);
|
|
59
|
+
border: 1px solid var(--dev-tool-success-color);
|
|
60
|
+
}
|
|
61
|
+
.tag-error {
|
|
62
|
+
background-color: var(--dev-tool-error-color);
|
|
63
|
+
border: 1px solid var(--dev-tool-error-color);
|
|
64
|
+
}
|
|
65
|
+
.tag-main {
|
|
66
|
+
background-color: var(--dev-tool-main-color);
|
|
67
|
+
color: #fff;
|
|
68
|
+
border: 1px solid var(--dev-tool-main-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.tag-primary {
|
|
72
|
+
color: #fff;
|
|
73
|
+
background-color: #0958d9;
|
|
74
|
+
border: 1px solid #0958d9;
|
|
75
|
+
}
|
|
76
|
+
.tag-clear {
|
|
77
|
+
color: #0958d9;
|
|
78
|
+
border: 1px solid #0958d9;
|
|
79
|
+
}
|
|
80
|
+
.tag-all {
|
|
81
|
+
color: var(--dev-tool-text-color);
|
|
82
|
+
border: 1px solid #000;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.tag-active {
|
|
86
|
+
border-color: var(--dev-tool-main-color);
|
|
87
|
+
color: var(--dev-tool-main-color);
|
|
88
|
+
}
|
|
89
|
+
</style>
|