vite-uni-dev-tool 0.0.12 → 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.
- 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/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.d.ts +5 -0
- package/dist/v2/AutoSizer/utils.d.ts.map +1 -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/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.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/index.vue +531 -0
- package/dist/v2/JsonPretty/type.d.ts +93 -0
- package/dist/v2/JsonPretty/type.d.ts.map +1 -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/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/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/{dev/components → dist/v3}/AppInfo/index.vue +0 -1
- package/dist/v3/AutoSizer/utils.d.ts +5 -0
- package/dist/v3/AutoSizer/utils.d.ts.map +1 -0
- package/dist/v3/AutoSizer/utils.ts +49 -0
- package/{dev/components → dist/v3}/CloseButton/index.vue +5 -2
- package/{dev/components → dist/v3}/ConsoleList/ConsoleItem.vue +10 -9
- package/{dev/components → dist/v3}/ConsoleList/RunJSInput.vue +5 -2
- package/dist/v3/ConsoleList/staticTips.d.ts +13 -0
- package/dist/v3/ConsoleList/staticTips.d.ts.map +1 -0
- package/{dev/components → dist/v3}/DevTool/index.vue +33 -4
- package/{dev/components → dist/v3}/DevToolWindow/index.vue +67 -4
- package/dist/v3/Empty/empty.png +0 -0
- package/{dev/components → dist/v3}/FilterInput/index.vue +5 -4
- 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/useClipboard.ts +21 -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/hooks/useError.ts +21 -0
- package/{dev/components → dist/v3}/JsonPretty/index.vue +10 -10
- package/dist/v3/JsonPretty/type.d.ts +93 -0
- package/dist/v3/JsonPretty/type.d.ts.map +1 -0
- package/dist/v3/JsonPretty/type.ts +125 -0
- package/dist/v3/JsonPretty/utils/index.d.ts +10 -0
- package/dist/v3/JsonPretty/utils/index.d.ts.map +1 -0
- package/{dev/components → dist/v3}/NetworkList/NetworkDetail.vue +2 -2
- package/{dev/components → dist/v3}/NetworkList/NetworkItem.vue +2 -1
- package/dist/v3/RunJS/index.vue +128 -0
- package/{dev/components → dist/v3}/SettingList/index.vue +128 -37
- package/{dev/components → dist/v3}/SourceCode/index.vue +2 -2
- package/{dev/components → dist/v3}/Tag/index.vue +4 -4
- package/{dev/components → dist/v3}/UploadList/UploadDetail.vue +3 -15
- package/{dev/components → dist/v3}/UploadList/UploadItem.vue +1 -1
- package/dist/v3/VirtualListPro/readme.md +40 -0
- package/{dev/components → dist/v3}/WebSocket/WebSocketItem.vue +1 -1
- package/{dev/components → dist/v3}/WebSocket/WebSocketList.vue +3 -15
- package/package.json +5 -5
- package/dev/components/Button/index.vue +0 -34
- package/dev/components/Checkbox/index.vue +0 -40
- package/dev/components/Code/index.vue +0 -230
- package/dev/components/ConsoleList/Code.vue +0 -227
- 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
- /package/{dev/components → dist/v2}/AutoSizer/utils.ts +0 -0
- /package/{dev/components → dist/v2}/Empty/empty.png +0 -0
- /package/{dev/components → dist/v2}/JsonPretty/hooks/useClipboard.ts +0 -0
- /package/{dev/components → dist/v2}/JsonPretty/hooks/useError.ts +0 -0
- /package/{dev/components → dist/v2}/JsonPretty/type.ts +0 -0
- /package/{dev/components → dist/v2}/RunJS/index.vue +0 -0
- /package/{dev/components → dist/v2}/VirtualListPro/readme.md +0 -0
- /package/{dev/components → dist/v3}/AutoSizer/index.vue +0 -0
- /package/{dev/components → dist/v3}/AutoSizer/index1.vue +0 -0
- /package/{dev/components → dist/v3}/CaptureScreen/index.vue +0 -0
- /package/{dev/components → dist/v3}/Connection/index.vue +0 -0
- /package/{dev/components → dist/v3}/ConsoleList/index.vue +0 -0
- /package/{dev/components → dist/v3}/ConsoleList/staticTips.ts +0 -0
- /package/{dev/components → dist/v3}/DevToolButton/index.vue +0 -0
- /package/{dev/components → dist/v3}/DevToolTitle/index.vue +0 -0
- /package/{dev/components → dist/v3}/DeviceInfo/index.vue +0 -0
- /package/{dev/components → dist/v3}/Empty/index.vue +0 -0
- /package/{dev/components → dist/v3}/JsonPretty/components/Brackets/index.vue +0 -0
- /package/{dev/components → dist/v3}/JsonPretty/components/Carets/index.vue +0 -0
- /package/{dev/components → dist/v3}/JsonPretty/components/CheckController/index.vue +0 -0
- /package/{dev/components → dist/v3}/JsonPretty/components/TreeNode/index.vue +0 -0
- /package/{dev/components → dist/v3}/JsonPretty/utils/index.ts +0 -0
- /package/{dev/components → dist/v3}/NetworkList/index.vue +0 -0
- /package/{dev/components → dist/v3}/PiniaList/index.vue +0 -0
- /package/{dev/components → dist/v3}/RouteList/index.vue +0 -0
- /package/{dev/components → dist/v3}/StorageList/index.vue +0 -0
- /package/{dev/components → dist/v3}/SystemInfo/index.vue +0 -0
- /package/{dev/components → dist/v3}/Tabs/index.vue +0 -0
- /package/{dev/components → dist/v3}/UniEvent/UniEventItem.vue +0 -0
- /package/{dev/components → dist/v3}/UniEvent/index.vue +0 -0
- /package/{dev/components → dist/v3}/UploadList/index.vue +0 -0
- /package/{dev/components → dist/v3}/VirtualList/index.vue +0 -0
- /package/{dev/components → dist/v3}/VirtualListPro/AutoSize.vue +0 -0
- /package/{dev/components → dist/v3}/VirtualListPro/index.vue +0 -0
- /package/{dev/components → dist/v3}/VuexList/index.vue +0 -0
- /package/{dev/components → dist/v3}/WebSocket/index.vue +0 -0
- /package/{dev/components → dist/v3}/WindowInfo/index.vue +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="auto-sizer">
|
|
3
|
+
<!-- 大小和slot 内容宽度一致 -->
|
|
4
|
+
<view class="listener-slot">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</view>
|
|
7
|
+
|
|
8
|
+
<!-- 变大监听固定在 listener-slot 右下角大1px位置 变大时 相交触发监听 -->
|
|
9
|
+
<view
|
|
10
|
+
class="anchor-height-add"
|
|
11
|
+
:style="{
|
|
12
|
+
top: listenerSlot.height + 1 + 'px',
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
</view>
|
|
16
|
+
|
|
17
|
+
<!-- 变小监听固定在 listener-slot 右下角小1px位置 减小时 离开触发监听 -->
|
|
18
|
+
<view
|
|
19
|
+
class="anchor-height-sub"
|
|
20
|
+
:style="{
|
|
21
|
+
top: listenerSlot.height - 1 + 'px',
|
|
22
|
+
}"
|
|
23
|
+
>
|
|
24
|
+
</view>
|
|
25
|
+
|
|
26
|
+
<!-- 变大监听固定在 listener-slot 右下角大1px位置 变大时 相交触发监听 -->
|
|
27
|
+
<view
|
|
28
|
+
class="anchor-width-add"
|
|
29
|
+
:style="{
|
|
30
|
+
left: listenerSlot.width + 1 + 'px',
|
|
31
|
+
top: '0px',
|
|
32
|
+
}"
|
|
33
|
+
>
|
|
34
|
+
</view>
|
|
35
|
+
|
|
36
|
+
<!-- 变小监听固定在 listener-slot 右下角小1px位置 减小时 离开触发监听 -->
|
|
37
|
+
<view
|
|
38
|
+
class="anchor-width-sub"
|
|
39
|
+
:style="{
|
|
40
|
+
left: listenerSlot.width - 1 + 'px',
|
|
41
|
+
top: '0px',
|
|
42
|
+
}"
|
|
43
|
+
>
|
|
44
|
+
</view>
|
|
45
|
+
</view>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import { debounce } from '../../utils';
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
inject: ['onSizeChange', 'itemsHeight'],
|
|
53
|
+
props: {
|
|
54
|
+
index: {
|
|
55
|
+
type: Number,
|
|
56
|
+
required: true,
|
|
57
|
+
},
|
|
58
|
+
immediate: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
data() {
|
|
65
|
+
return {
|
|
66
|
+
isMounted: false,
|
|
67
|
+
listenerSlot: {
|
|
68
|
+
width: 0,
|
|
69
|
+
height: 0,
|
|
70
|
+
},
|
|
71
|
+
size: {
|
|
72
|
+
width: 0,
|
|
73
|
+
height: 0,
|
|
74
|
+
top: 0,
|
|
75
|
+
left: 0,
|
|
76
|
+
right: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
},
|
|
79
|
+
observer: null,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
created() {
|
|
84
|
+
this.debounceReact = debounce(
|
|
85
|
+
(rect) => {
|
|
86
|
+
if (Array.isArray(rect)) return;
|
|
87
|
+
|
|
88
|
+
// 获取屏幕尺寸
|
|
89
|
+
const { windowWidth, windowHeight } = uni.getSystemInfoSync();
|
|
90
|
+
|
|
91
|
+
// 在尺寸更新时限制最大值
|
|
92
|
+
this.listenerSlot.height = Math.min(rect.height ?? 0, windowHeight);
|
|
93
|
+
this.listenerSlot.width = Math.min(rect.width ?? 0, windowWidth);
|
|
94
|
+
|
|
95
|
+
this?.onSizeChange?.(this.index, rect.height ?? 0);
|
|
96
|
+
|
|
97
|
+
this.size.width = rect.width ?? 0;
|
|
98
|
+
this.size.height = rect.height ?? 0;
|
|
99
|
+
this.size.top = rect.top ?? 0;
|
|
100
|
+
this.size.left = rect.left ?? 0;
|
|
101
|
+
this.size.right = rect.right ?? 0;
|
|
102
|
+
this.size.bottom = rect.bottom ?? 0;
|
|
103
|
+
|
|
104
|
+
if (this.immediate && !this.isMounted) {
|
|
105
|
+
this.$emit('resize', this.size);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (this.isMounted) {
|
|
109
|
+
this.$emit('resize', this.size);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.isMounted = true;
|
|
113
|
+
},
|
|
114
|
+
100,
|
|
115
|
+
true,
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
this.debounceGetSize = debounce(this.getSize, 100, true);
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
mounted() {
|
|
122
|
+
// 防止重复获取
|
|
123
|
+
// TODO
|
|
124
|
+
// if (this.itemsHeight && this.itemsHeight?.[this.index]) return;
|
|
125
|
+
|
|
126
|
+
// 初始大小
|
|
127
|
+
this.debounceGetSize();
|
|
128
|
+
|
|
129
|
+
// TODO 只有可视范围之内才获取大小
|
|
130
|
+
this.observer = uni.createIntersectionObserver(this, {
|
|
131
|
+
thresholds: [0, 1],
|
|
132
|
+
});
|
|
133
|
+
// 变大监听
|
|
134
|
+
this.observer
|
|
135
|
+
.relativeTo('.auto-sizer')
|
|
136
|
+
.observe('.anchor-height-add', this.debounceGetSize);
|
|
137
|
+
// 变小监听
|
|
138
|
+
this.observer
|
|
139
|
+
.relativeTo('.auto-sizer')
|
|
140
|
+
.observe('.anchor-height-sub', this.debounceGetSize);
|
|
141
|
+
|
|
142
|
+
// 变大监听
|
|
143
|
+
this.observer
|
|
144
|
+
.relativeTo('.auto-sizer')
|
|
145
|
+
.observe('.anchor-width-add', this.debounceGetSize);
|
|
146
|
+
// 变小监听
|
|
147
|
+
this.observer
|
|
148
|
+
.relativeTo('.auto-sizer')
|
|
149
|
+
.observe('.anchor-width-sub', this.debounceGetSize);
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
beforeDestroy() {
|
|
153
|
+
// 销毁监听
|
|
154
|
+
this.observer.disconnect();
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
methods: {
|
|
158
|
+
getSize() {
|
|
159
|
+
uni
|
|
160
|
+
.createSelectorQuery()
|
|
161
|
+
.in(this)
|
|
162
|
+
.select('.listener-slot')
|
|
163
|
+
.boundingClientRect(this.debounceReact)
|
|
164
|
+
.exec();
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
</script>
|
|
169
|
+
|
|
170
|
+
<style scoped>
|
|
171
|
+
.auto-sizer {
|
|
172
|
+
position: relative;
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
width: min-content;
|
|
175
|
+
height: min-content;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.anchor-height-add,
|
|
179
|
+
.anchor-height-sub,
|
|
180
|
+
.anchor-width-add,
|
|
181
|
+
.anchor-width-sub {
|
|
182
|
+
position: absolute;
|
|
183
|
+
width: 1px;
|
|
184
|
+
height: 1px;
|
|
185
|
+
|
|
186
|
+
background-color: skyblue;
|
|
187
|
+
visibility: hidden;
|
|
188
|
+
}
|
|
189
|
+
</style>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="l-resize l-class"
|
|
4
|
+
:class="{ 'l-resize-target': hasNoDefaultSlot }"
|
|
5
|
+
:style="[styles, lStyle]"
|
|
6
|
+
>
|
|
7
|
+
<!-- 插槽需要脱离父容器文档流,防止父容器固宽固高导致插槽大小被限制 -->
|
|
8
|
+
<view
|
|
9
|
+
ref="lResizeContainer"
|
|
10
|
+
class="l-resize__container l-container-class"
|
|
11
|
+
:style="[lStyle]"
|
|
12
|
+
>
|
|
13
|
+
<!-- 被监听的插槽 -->
|
|
14
|
+
<slot></slot>
|
|
15
|
+
<!-- 监听插槽变大 -->
|
|
16
|
+
<scroll-view
|
|
17
|
+
class="l-resize__wrapper"
|
|
18
|
+
:scroll-y="true"
|
|
19
|
+
:scroll-x="true"
|
|
20
|
+
:scroll-top="expandScrollTop"
|
|
21
|
+
:scroll-left="expandScrollLeft"
|
|
22
|
+
@scroll="onScrollHandler"
|
|
23
|
+
>
|
|
24
|
+
<view
|
|
25
|
+
class="l-resize__wrapper--placeholder"
|
|
26
|
+
style="height: 100000px; width: 100000px"
|
|
27
|
+
></view>
|
|
28
|
+
</scroll-view>
|
|
29
|
+
<!-- 监听插槽变小 -->
|
|
30
|
+
<scroll-view
|
|
31
|
+
class="l-resize__wrapper"
|
|
32
|
+
:scroll-y="true"
|
|
33
|
+
:scroll-x="true"
|
|
34
|
+
:scroll-top="shrinkScrollTop"
|
|
35
|
+
:scroll-left="shrinkScrollLeft"
|
|
36
|
+
@scroll="onScrollHandler"
|
|
37
|
+
>
|
|
38
|
+
<view
|
|
39
|
+
class="l-resize__wrapper--placeholder"
|
|
40
|
+
style="height: 250%; width: 250%"
|
|
41
|
+
></view>
|
|
42
|
+
</scroll-view>
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
import { getRect, addUnit } from './utils';
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
props: {
|
|
52
|
+
lStyle: {
|
|
53
|
+
type: [String, Object],
|
|
54
|
+
default: () => ({}),
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
width: 0,
|
|
61
|
+
height: 0,
|
|
62
|
+
hasNoDefaultSlot: false,
|
|
63
|
+
expandScrollTop: 0,
|
|
64
|
+
expandScrollLeft: 0,
|
|
65
|
+
shrinkScrollTop: 0,
|
|
66
|
+
shrinkScrollLeft: 0,
|
|
67
|
+
scrollEventCount: 0,
|
|
68
|
+
lastHeight: 0,
|
|
69
|
+
lastWidth: 0,
|
|
70
|
+
querySelector: '.l-resize__container',
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
computed: {
|
|
75
|
+
styles() {
|
|
76
|
+
// Vue2 中通过 this.$slots 访问插槽
|
|
77
|
+
if (this.$slots.default && (this.width || this.height)) {
|
|
78
|
+
return {
|
|
79
|
+
width: addUnit(this.width),
|
|
80
|
+
height: addUnit(this.height),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {};
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
mounted() {
|
|
88
|
+
// 检查是否有默认插槽
|
|
89
|
+
this.hasNoDefaultSlot = !this.$slots.default;
|
|
90
|
+
|
|
91
|
+
// 初始获取尺寸
|
|
92
|
+
getRect(this.querySelector, this).then((res) => {
|
|
93
|
+
this.lastHeight = res.height || 0;
|
|
94
|
+
this.lastWidth = res.width || 0;
|
|
95
|
+
this.width = this.lastWidth;
|
|
96
|
+
this.height = this.lastHeight;
|
|
97
|
+
this.scrollToBottom({
|
|
98
|
+
width: this.lastWidth,
|
|
99
|
+
height: this.lastHeight,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
methods: {
|
|
105
|
+
onScrollHandler() {
|
|
106
|
+
getRect(this.querySelector, this).then((res) => {
|
|
107
|
+
// 前两次滚动事件触发时通知尺寸变化
|
|
108
|
+
if (this.scrollEventCount++ === 0) {
|
|
109
|
+
this.resizeEvent(res);
|
|
110
|
+
}
|
|
111
|
+
// 屏蔽滚动条拉到底部的多余事件
|
|
112
|
+
if (this.scrollEventCount < 3) return;
|
|
113
|
+
|
|
114
|
+
const newHeight = res.height || 0;
|
|
115
|
+
const newWidth = res.width || 0;
|
|
116
|
+
|
|
117
|
+
// 更新容器尺寸
|
|
118
|
+
this.height = newHeight;
|
|
119
|
+
this.width = newWidth;
|
|
120
|
+
|
|
121
|
+
// 检查尺寸变化并触发事件
|
|
122
|
+
const emitStack = [];
|
|
123
|
+
if (newHeight !== this.lastHeight) {
|
|
124
|
+
this.lastHeight = newHeight;
|
|
125
|
+
emitStack.push(1);
|
|
126
|
+
}
|
|
127
|
+
if (newWidth !== this.lastWidth) {
|
|
128
|
+
this.lastWidth = newWidth;
|
|
129
|
+
emitStack.push(1);
|
|
130
|
+
}
|
|
131
|
+
if (emitStack.length > 0) {
|
|
132
|
+
this.resizeEvent(res);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// 滚动到底部
|
|
136
|
+
this.scrollToBottom({
|
|
137
|
+
width: this.lastWidth,
|
|
138
|
+
height: this.lastHeight,
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
scrollToBottom(res) {
|
|
144
|
+
this.expandScrollTop = 100000 + res.height;
|
|
145
|
+
this.shrinkScrollTop = 3 * this.height + res.height;
|
|
146
|
+
this.expandScrollLeft = 100000 + res.width;
|
|
147
|
+
this.shrinkScrollLeft = 3 * this.width + res.width;
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
resizeEvent(res) {
|
|
151
|
+
const result = {};
|
|
152
|
+
['bottom', 'top', 'left', 'right', 'height', 'width'].forEach((prop) => {
|
|
153
|
+
result[prop] = res[prop];
|
|
154
|
+
});
|
|
155
|
+
this.$emit('resize', result);
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<style lang="scss" scoped>
|
|
162
|
+
.l-resize {
|
|
163
|
+
&__container {
|
|
164
|
+
position: absolute;
|
|
165
|
+
min-width: 1px;
|
|
166
|
+
min-height: 1px;
|
|
167
|
+
}
|
|
168
|
+
&-target,
|
|
169
|
+
&__wrapper {
|
|
170
|
+
background-color: aqua;
|
|
171
|
+
position: absolute;
|
|
172
|
+
top: 0;
|
|
173
|
+
bottom: 0;
|
|
174
|
+
left: 0;
|
|
175
|
+
right: 0;
|
|
176
|
+
z-index: -9999;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
visibility: hidden;
|
|
179
|
+
}
|
|
180
|
+
&-target {
|
|
181
|
+
.l-resize__container {
|
|
182
|
+
width: 100%;
|
|
183
|
+
height: 100%;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
&__wrapper {
|
|
187
|
+
&--placeholder {
|
|
188
|
+
transition: 0s;
|
|
189
|
+
animation: none;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentInternalInstance } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare function getRect(selector: string, context: ComponentInternalInstance | null | any, node?: boolean): Promise<UniApp.NodeInfo>;
|
|
4
|
+
export declare function addUnit(value?: string | number): string;
|
|
5
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../dev/v2/AutoSizer/utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,yBAAyB,EAA2B,MAAM,KAAK,CAAC;AAE9E,wBAAgB,OAAO,CACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,yBAAyB,GAAG,IAAI,GAAG,GAAG,EAC/C,IAAI,GAAE,OAAe,4BAmCtB;AAED,wBAAgB,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAMvD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="capture-screen-content">
|
|
3
|
+
<view class="capture-screen-control">
|
|
4
|
+
<Tag style="margin-left: auto" mode="clear" @click="handleClear">
|
|
5
|
+
清空
|
|
6
|
+
</Tag>
|
|
7
|
+
</view>
|
|
8
|
+
|
|
9
|
+
<view class="capture-screen-list">
|
|
10
|
+
<view
|
|
11
|
+
class="capture-screen-item"
|
|
12
|
+
v-for="item in captureScreenList"
|
|
13
|
+
:key="item.timer + item.position"
|
|
14
|
+
>
|
|
15
|
+
<view class="info-row">时间:{{ item.timer }} </view>
|
|
16
|
+
<view class="info-row">页面:{{ item.position }}</view>
|
|
17
|
+
</view>
|
|
18
|
+
|
|
19
|
+
<Empty v-if="!captureScreenList || captureScreenList.length === 0" />
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import Empty from '../Empty/index.vue';
|
|
26
|
+
import Tag from '../Tag/index.vue';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
components: {
|
|
30
|
+
Empty,
|
|
31
|
+
Tag,
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
/** @type {{position: string, time: string}[]} */
|
|
35
|
+
captureScreenList: {
|
|
36
|
+
type: Array,
|
|
37
|
+
default: () => [],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
handleClear() {
|
|
42
|
+
this.$emit('clear');
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.capture-screen-content {
|
|
50
|
+
height: 100%;
|
|
51
|
+
font-size: var(--dev-tool-base-font-size);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.capture-screen-list {
|
|
55
|
+
height: calc(100% - 32px);
|
|
56
|
+
overflow: auto;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.capture-screen-control {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
padding: 0 16px;
|
|
65
|
+
height: 32px;
|
|
66
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
67
|
+
box-sizing: border-box;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.capture-screen-item {
|
|
71
|
+
padding: 16px;
|
|
72
|
+
border-bottom: 1px solid var(--dev-tool-border-color);
|
|
73
|
+
}
|
|
74
|
+
.info-row {
|
|
75
|
+
height: 28px;
|
|
76
|
+
line-height: 28px;
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="close-button" @click="onClick"> × </view>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
methods: {
|
|
8
|
+
onClick() {
|
|
9
|
+
this.$emit('click');
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style scoped>
|
|
16
|
+
.close-button {
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
width: 24px;
|
|
22
|
+
height: 24px;
|
|
23
|
+
margin-left: auto;
|
|
24
|
+
border-radius: 50%;
|
|
25
|
+
border: 1px solid var(--dev-tool-text-color);
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
color: var(--dev-tool-text-color);
|
|
28
|
+
transition:
|
|
29
|
+
border,
|
|
30
|
+
color 0.3s;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="connection-content">
|
|
3
|
+
<view class="connection-item">
|
|
4
|
+
<DevToolTitle>网络连接</DevToolTitle>
|
|
5
|
+
<view class="connection-item-content">
|
|
6
|
+
<view class="connection-row">
|
|
7
|
+
<view>IP地址:</view>
|
|
8
|
+
<Tag
|
|
9
|
+
:mode="
|
|
10
|
+
netWorkStatus.isConnected === undefined || netWorkStatus.ip
|
|
11
|
+
? 'info'
|
|
12
|
+
: netWorkStatus.isConnected && netWorkStatus.ip
|
|
13
|
+
? 'success'
|
|
14
|
+
: 'error'
|
|
15
|
+
"
|
|
16
|
+
>
|
|
17
|
+
{{
|
|
18
|
+
netWorkStatus.isConnected === undefined
|
|
19
|
+
? '未获取'
|
|
20
|
+
: netWorkStatus.ip || '未获取'
|
|
21
|
+
}}
|
|
22
|
+
</Tag>
|
|
23
|
+
</view>
|
|
24
|
+
<view class="connection-row">
|
|
25
|
+
<view>连接状态:</view>
|
|
26
|
+
<Tag
|
|
27
|
+
:mode="
|
|
28
|
+
netWorkStatus.isConnected === undefined
|
|
29
|
+
? 'info'
|
|
30
|
+
: netWorkStatus.isConnected
|
|
31
|
+
? 'success'
|
|
32
|
+
: 'error'
|
|
33
|
+
"
|
|
34
|
+
>
|
|
35
|
+
{{
|
|
36
|
+
netWorkStatus.isConnected === undefined
|
|
37
|
+
? '未获取'
|
|
38
|
+
: netWorkStatus.isConnected
|
|
39
|
+
? '已连接'
|
|
40
|
+
: '已断开'
|
|
41
|
+
}}
|
|
42
|
+
</Tag>
|
|
43
|
+
</view>
|
|
44
|
+
<view class="connection-row">
|
|
45
|
+
<view>网络类型:</view>
|
|
46
|
+
<Tag mode="info">{{ netWorkStatus.networkType || '未获取' }}</Tag>
|
|
47
|
+
</view>
|
|
48
|
+
</view>
|
|
49
|
+
</view>
|
|
50
|
+
</view>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
import Tag from '../Tag/index.vue';
|
|
55
|
+
import DevToolTitle from '../DevToolTitle/index.vue';
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
components: {
|
|
59
|
+
Tag,
|
|
60
|
+
DevToolTitle,
|
|
61
|
+
},
|
|
62
|
+
props: {
|
|
63
|
+
netWorkStatus: {
|
|
64
|
+
type: Object,
|
|
65
|
+
default() {
|
|
66
|
+
return {
|
|
67
|
+
isConnected: undefined,
|
|
68
|
+
networkType: undefined,
|
|
69
|
+
ip: undefined,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<style scoped>
|
|
78
|
+
.connection-content {
|
|
79
|
+
height: 100%;
|
|
80
|
+
overflow: auto;
|
|
81
|
+
font-size: var(--dev-tool-base-font-size);
|
|
82
|
+
}
|
|
83
|
+
.connection-item {
|
|
84
|
+
padding: 16px 16px 0 16px;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.connection-row {
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: space-between;
|
|
92
|
+
margin: 8px 0;
|
|
93
|
+
}
|
|
94
|
+
</style>
|