vite-uni-dev-tool 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +8 -0
  2. package/dist/const.cjs +1 -1
  3. package/dist/const.d.ts +1 -0
  4. package/dist/const.d.ts.map +1 -1
  5. package/dist/const.js +1 -1
  6. package/dist/core.d.ts.map +1 -1
  7. package/dist/core.js +2 -2
  8. package/dist/i18n/locales/en.cjs +1 -1
  9. package/dist/i18n/locales/en.d.ts +5 -0
  10. package/dist/i18n/locales/en.d.ts.map +1 -1
  11. package/dist/i18n/locales/en.js +1 -1
  12. package/dist/i18n/locales/zh-Hans.cjs +1 -1
  13. package/dist/i18n/locales/zh-Hans.d.ts +5 -0
  14. package/dist/i18n/locales/zh-Hans.d.ts.map +1 -1
  15. package/dist/i18n/locales/zh-Hans.js +1 -1
  16. package/dist/modules/devIntercept/index.cjs +9 -9
  17. package/dist/modules/devIntercept/index.d.ts +1 -1
  18. package/dist/modules/devIntercept/index.d.ts.map +1 -1
  19. package/dist/modules/devIntercept/index.js +9 -9
  20. package/dist/modules/devStore/index.cjs +1 -1
  21. package/dist/modules/devStore/index.d.ts.map +1 -1
  22. package/dist/modules/devStore/index.js +1 -1
  23. package/dist/plugins/uniDevTool/transform/transformMain.cjs +3 -3
  24. package/dist/plugins/uniDevTool/transform/transformMain.d.ts +2 -1
  25. package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -1
  26. package/dist/plugins/uniDevTool/transform/transformMain.js +3 -3
  27. package/dist/plugins/uniDevTool/transform/transformVue.cjs +31 -25
  28. package/dist/plugins/uniDevTool/transform/transformVue.d.ts +2 -1
  29. package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -1
  30. package/dist/plugins/uniDevTool/transform/transformVue.js +30 -24
  31. package/dist/plugins/uniDevTool/uniDevTool.cjs +3 -3
  32. package/dist/plugins/uniDevTool/uniDevTool.d.ts +3 -1
  33. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  34. package/dist/plugins/uniDevTool/uniDevTool.js +3 -3
  35. package/dist/type.d.ts +3 -0
  36. package/dist/type.d.ts.map +1 -1
  37. package/dist/v3/DevTool/components/BluetoothList/BluetoothItem.vue +199 -199
  38. package/dist/v3/DevTool/components/BluetoothList/BluetoothTool.vue +730 -730
  39. package/dist/v3/DevTool/components/BluetoothList/index.vue +167 -167
  40. package/dist/v3/DevTool/components/CaptureScreen/index.vue +109 -109
  41. package/dist/v3/DevTool/components/ConsoleList/ConsoleItem.vue +230 -225
  42. package/dist/v3/DevTool/components/ConsoleList/RunJSInput.vue +247 -247
  43. package/dist/v3/DevTool/components/ConsoleList/index.vue +171 -171
  44. package/dist/v3/DevTool/components/ConsoleList/staticTips.ts +1145 -1145
  45. package/dist/v3/DevTool/components/DevToolTitle/index.vue +24 -24
  46. package/dist/v3/DevTool/components/DevToolWindow/DevToolOverlay.vue +197 -197
  47. package/dist/v3/DevTool/components/DevToolWindow/hooks/dataUtils.ts +48 -48
  48. package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolData.ts +387 -387
  49. package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolHandlers.ts +629 -629
  50. package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolOverlay.ts +201 -197
  51. package/dist/v3/DevTool/components/ElEvent/ElEventItem.vue +105 -105
  52. package/dist/v3/DevTool/components/ElEvent/index.vue +106 -106
  53. package/dist/v3/DevTool/components/Instance/components/InstanceTreeNode.vue +265 -265
  54. package/dist/v3/DevTool/components/Instance/flatten.ts +226 -226
  55. package/dist/v3/DevTool/components/Instance/index.vue +94 -94
  56. package/dist/v3/DevTool/components/Instance/registry.ts +49 -49
  57. package/dist/v3/DevTool/components/Instance/transformTree.ts +375 -375
  58. package/dist/v3/DevTool/components/Instance/transformTreeCtx.ts +268 -268
  59. package/dist/v3/DevTool/components/Instance/typing.d.ts +43 -43
  60. package/dist/v3/DevTool/components/InstanceDetail/index.vue +485 -485
  61. package/dist/v3/DevTool/components/JsonDetail/index.vue +70 -70
  62. package/dist/v3/DevTool/components/NFCList/NFCItem.vue +112 -112
  63. package/dist/v3/DevTool/components/NFCList/NFCTool.vue +454 -454
  64. package/dist/v3/DevTool/components/NFCList/const.ts +56 -56
  65. package/dist/v3/DevTool/components/NFCList/index.vue +94 -94
  66. package/dist/v3/DevTool/components/NetworkList/InterceptConfig.vue +624 -624
  67. package/dist/v3/DevTool/components/NetworkList/InterceptItem.vue +140 -140
  68. package/dist/v3/DevTool/components/NetworkList/NetworkDetail.vue +287 -287
  69. package/dist/v3/DevTool/components/NetworkList/NetworkIntercept.vue +88 -88
  70. package/dist/v3/DevTool/components/NetworkList/NetworkItem.vue +163 -163
  71. package/dist/v3/DevTool/components/NetworkList/NetworkSend.vue +589 -589
  72. package/dist/v3/DevTool/components/NetworkList/const.ts +4 -4
  73. package/dist/v3/DevTool/components/NetworkList/hooks/useNetworkForm.ts +86 -86
  74. package/dist/v3/DevTool/components/NetworkList/index.vue +160 -160
  75. package/dist/v3/DevTool/components/NetworkList/utils.ts +101 -101
  76. package/dist/v3/DevTool/components/Performance/index.vue +498 -498
  77. package/dist/v3/DevTool/components/Performance/modules/PerformanceMetrics.vue +153 -153
  78. package/dist/v3/DevTool/components/Performance/modules/usePerformanceChart.ts +460 -460
  79. package/dist/v3/DevTool/components/Performance/modules/usePerformanceData.ts +258 -258
  80. package/dist/v3/DevTool/components/PiniaList/index.vue +93 -93
  81. package/dist/v3/DevTool/components/RunJS/index.vue +148 -148
  82. package/dist/v3/DevTool/components/ScanCodeList/ScanCodeItem.vue +97 -97
  83. package/dist/v3/DevTool/components/ScanCodeList/index.vue +100 -100
  84. package/dist/v3/DevTool/components/SettingButton/index.vue +45 -45
  85. package/dist/v3/DevTool/components/SettingList/index.vue +218 -218
  86. package/dist/v3/DevTool/components/SettingList/modules/SettingBarrage.vue +304 -304
  87. package/dist/v3/DevTool/components/SettingList/modules/SettingDevTool.vue +212 -212
  88. package/dist/v3/DevTool/components/SettingList/modules/SettingInfo.vue +157 -157
  89. package/dist/v3/DevTool/components/SettingList/modules/SettingLanguage.vue +74 -74
  90. package/dist/v3/DevTool/components/SettingList/modules/SettingLog.vue +230 -230
  91. package/dist/v3/DevTool/components/SettingList/typing.d.ts +2 -2
  92. package/dist/v3/DevTool/components/SourceCode/Line.vue +127 -127
  93. package/dist/v3/DevTool/components/SourceCode/parseCode.ts +609 -609
  94. package/dist/v3/DevTool/components/StorageList/index.vue +174 -174
  95. package/dist/v3/DevTool/components/TransferList/TransferDetail.vue +268 -268
  96. package/dist/v3/DevTool/components/VuexList/index.vue +84 -84
  97. package/dist/v3/DevTool/index.vue +1 -0
  98. package/dist/v3/components/AppTransition/index.vue +176 -176
  99. package/dist/v3/components/AutoSizer/index.vue +192 -192
  100. package/dist/v3/components/AutoSizer/index1.vue +184 -184
  101. package/dist/v3/components/AutoSizer/utils.ts +49 -49
  102. package/dist/v3/components/Barrage/BarrageItem.vue +137 -137
  103. package/dist/v3/components/Barrage/index.vue +202 -202
  104. package/dist/v3/components/CircularButton/index.vue +84 -84
  105. package/dist/v3/components/CustomSwiper/CustomSwiperItem.vue +49 -49
  106. package/dist/v3/components/CustomSwiper/index.vue +104 -104
  107. package/dist/v3/components/DevErrorBoundary/index.vue +380 -0
  108. package/dist/v3/components/Empty/index.vue +29 -29
  109. package/dist/v3/components/FilterSelect/index.vue +179 -179
  110. package/dist/v3/components/JsonPretty/components/Brackets/index.vue +27 -27
  111. package/dist/v3/components/JsonPretty/components/Carets/index.vue +59 -59
  112. package/dist/v3/components/JsonPretty/components/CheckController/index.vue +136 -136
  113. package/dist/v3/components/JsonPretty/components/TreeNode/index.vue +387 -387
  114. package/dist/v3/components/JsonPretty/hooks/useClipboard.ts +21 -21
  115. package/dist/v3/components/JsonPretty/hooks/useError.ts +21 -21
  116. package/dist/v3/components/JsonPretty/type.ts +127 -127
  117. package/dist/v3/components/JsonPretty/utils/index.ts +169 -169
  118. package/dist/v3/components/MovableContainer/index.vue +8 -4
  119. package/dist/v3/components/Pick/index.vue +322 -322
  120. package/dist/v3/components/Tag/index.vue +113 -113
  121. package/dist/v3/components/VirtualList/AutoSize.vue +40 -40
  122. package/dist/v3/components/VirtualList/index.vue +416 -416
  123. package/dist/v3/hooks/useBluetooth/index.ts +561 -561
  124. package/dist/v3/hooks/useContainerStyle.ts +153 -153
  125. package/dist/v3/hooks/useNFC/index.ts +107 -107
  126. package/dist/v3/hooks/useNFC/typing.d.ts +396 -396
  127. package/dist/v3/hooks/useNFC/useNFCAndroid.ts +966 -966
  128. package/dist/v3/hooks/useNFC/useNFCMpWeiXin.ts +812 -812
  129. package/dist/v3/hooks/useNFC/utils.ts +754 -754
  130. package/dist/v3/hooks/useRequest/index.ts +586 -586
  131. package/dist/v3/hooks/useRequest/utils.ts +267 -267
  132. package/dist/v3/hooks/useScanCode/index.ts +206 -206
  133. package/dist/v3/hooks/useWebsocket/index.ts +253 -253
  134. package/dist/v3/styles/theme.ts +12 -12
  135. package/package.json +9 -1
@@ -1,197 +1,201 @@
1
- import { ref, reactive, shallowRef, nextTick } from 'vue';
2
- import type { DevTool } from '../../../../../type';
3
- import { isMockWX, isAndroid } from '../../../../../utils/index';
4
- import { emptyNetwork } from '../const';
5
-
6
- export function useDevToolOverlay(props: any) {
7
- const openCode = ref(false);
8
- const stack = ref('');
9
- const showNetworkSend = ref(false);
10
- const showNetworkDetail = ref(false);
11
- const showNetworkIntercept = ref(false);
12
- const showInterceptConfig = ref(false);
13
- const showJsonDetail = ref(false);
14
- const jsonData = shallowRef<
15
- { title?: string; data: Record<string, any> } | undefined
16
- >();
17
- const showNfcTool = ref(false);
18
- const showTransferDetail = ref(false);
19
- const showWebSocketDetail = ref(false);
20
- const showBluetoothTool = ref(false);
21
- const bluetoothDevice = shallowRef<DevTool.BluetoothItem | null>(null);
22
-
23
- const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
24
- const transfer = reactive<DevTool.TransferItem>({
25
- index: 0,
26
- status: '',
27
- type: 'upload',
28
- });
29
- const webSocket = reactive<DevTool.WS>({ url: '', message: [] });
30
-
31
- function onCloseCode() {
32
- openCode.value = false;
33
- stack.value = '';
34
- }
35
-
36
- function onOpenCode(value?: string) {
37
- if (!value) return;
38
- stack.value = value;
39
- const isWXLink = isMockWX(value ?? '') || props.mode !== 'development';
40
- const isUseDevSource = !isWXLink && props.useDevSource;
41
-
42
- if (isWXLink) {
43
- uni.showToast({
44
- icon: 'none',
45
- title: '[DevTool] 请在小程序真机调试模式下查看源码',
46
- });
47
- return;
48
- }
49
- if (!isUseDevSource) return;
50
-
51
- if (isAndroid()) {
52
- if (props.sourceFileServers && props.sourceFileServers?.length > 0) {
53
- openCode.value = true;
54
- } else {
55
- uni.showToast({
56
- icon: 'none',
57
- title: '[DevTool] sourceFileServers 配置异常',
58
- });
59
- }
60
- } else {
61
- openCode.value = true;
62
- }
63
- }
64
-
65
- function onOpenJson(data?: { title?: string; data: Record<string, any> }) {
66
- showJsonDetail.value = true;
67
- jsonData.value = data;
68
- }
69
- function onCloseJson() {
70
- showJsonDetail.value = false;
71
- jsonData.value = undefined;
72
- }
73
-
74
- function onOpenNfcTool() {
75
- showNfcTool.value = true;
76
- }
77
- function onCloseNfcTool() {
78
- showNfcTool.value = false;
79
- }
80
-
81
- function onOpenBluetoothTool(device: DevTool.BluetoothItem) {
82
- bluetoothDevice.value = device;
83
- showBluetoothTool.value = true;
84
- }
85
- function onCloseBluetoothTool() {
86
- showBluetoothTool.value = false;
87
- bluetoothDevice.value = null;
88
- }
89
-
90
- function onOpenNetworkDetail(ni?: DevTool.NetworkItem) {
91
- Object.assign(network, emptyNetwork);
92
- Object.assign(network, ni);
93
- showNetworkDetail.value = true;
94
- }
95
- function onCloseNetworkDetail() {
96
- showNetworkDetail.value = false;
97
- }
98
-
99
- function onOpenNetworkSend(ni?: DevTool.NetworkItem) {
100
- Object.assign(network, emptyNetwork);
101
- Object.assign(network, ni);
102
- showNetworkSend.value = true;
103
- }
104
- function onCloseNetworkSend() {
105
- showNetworkSend.value = false;
106
- }
107
-
108
- function onOpenNetworkIntercept() {
109
- showNetworkIntercept.value = true;
110
- }
111
- function onCloseNetworkIntercept() {
112
- showNetworkIntercept.value = false;
113
- }
114
-
115
- function onOpenInterceptConfig(ni?: DevTool.NetworkItem) {
116
- Object.assign(network, emptyNetwork);
117
- if (ni) Object.assign(network, ni);
118
- showInterceptConfig.value = true;
119
- }
120
- function onCloseInterceptConfig() {
121
- showInterceptConfig.value = false;
122
- }
123
-
124
- function onOpenTransferDetail(item?: DevTool.TransferItem) {
125
- if ((item as any).formData) {
126
- delete (transfer as any).formData;
127
- }
128
- if ((item as any).filePath) {
129
- delete (transfer as any).filePath;
130
- }
131
- Object.assign(transfer, item);
132
- showTransferDetail.value = true;
133
- }
134
- function onCloseTransferDetail() {
135
- showTransferDetail.value = false;
136
- }
137
-
138
- function onOpenWebSocketDetail(ws?: DevTool.WS, currentWebSocket?: any) {
139
- Object.assign(webSocket, ws);
140
- nextTick(() => {
141
- // 兼容直接传入对象或传入 Ref 的情况
142
- if (
143
- currentWebSocket === undefined ||
144
- currentWebSocket?.value ||
145
- currentWebSocket
146
- ) {
147
- showWebSocketDetail.value = true;
148
- }
149
- });
150
- }
151
- function onCloseWebSocketDetail() {
152
- showWebSocketDetail.value = false;
153
- }
154
-
155
- return {
156
- state: reactive({
157
- openCode,
158
- stack,
159
- showNetworkSend,
160
- showNetworkDetail,
161
- showNetworkIntercept,
162
- showInterceptConfig,
163
- showJsonDetail,
164
- jsonData,
165
- showNfcTool,
166
- showTransferDetail,
167
- showWebSocketDetail,
168
- showBluetoothTool,
169
- bluetoothDevice,
170
- }),
171
- network,
172
- transfer,
173
- webSocket,
174
- handlers: {
175
- onCloseCode,
176
- onOpenCode,
177
- onOpenJson,
178
- onCloseJson,
179
- onOpenNfcTool,
180
- onCloseNfcTool,
181
- onOpenNetworkDetail,
182
- onCloseNetworkDetail,
183
- onOpenNetworkSend,
184
- onCloseNetworkSend,
185
- onOpenNetworkIntercept,
186
- onCloseNetworkIntercept,
187
- onOpenInterceptConfig,
188
- onCloseInterceptConfig,
189
- onOpenTransferDetail,
190
- onCloseTransferDetail,
191
- onOpenWebSocketDetail,
192
- onCloseWebSocketDetail,
193
- onOpenBluetoothTool,
194
- onCloseBluetoothTool,
195
- },
196
- };
197
- }
1
+ import { ref, reactive, shallowRef, nextTick } from 'vue';
2
+ import type { DevTool } from '../../../../../type';
3
+ import { isMockWX, isAndroid } from '../../../../../utils/index';
4
+ import { emptyNetwork } from '../const';
5
+
6
+ export function useDevToolOverlay(props: any) {
7
+ const openCode = ref(false);
8
+ const stack = ref('');
9
+ const showNetworkSend = ref(false);
10
+ const showNetworkDetail = ref(false);
11
+ const showNetworkIntercept = ref(false);
12
+ const showInterceptConfig = ref(false);
13
+ const showJsonDetail = ref(false);
14
+ const jsonData = shallowRef<
15
+ { title?: string; data: Record<string, any> } | undefined
16
+ >();
17
+ const showNfcTool = ref(false);
18
+ const showTransferDetail = ref(false);
19
+ const showWebSocketDetail = ref(false);
20
+ const showBluetoothTool = ref(false);
21
+ const bluetoothDevice = shallowRef<DevTool.BluetoothItem | null>(null);
22
+
23
+ const network = reactive<DevTool.NetworkItem>({ ...emptyNetwork });
24
+ const transfer = reactive<DevTool.TransferItem>({
25
+ index: 0,
26
+ status: '',
27
+ type: 'upload',
28
+ });
29
+ const webSocket = reactive<DevTool.WS>({ url: '', message: [] });
30
+
31
+ function onCloseCode() {
32
+ openCode.value = false;
33
+ stack.value = '';
34
+ }
35
+
36
+ function onOpenCode(value?: string) {
37
+ if (!value) return;
38
+ stack.value = value;
39
+
40
+ // 微信小程序下的虚拟路径,只能在小程序真机调试下打开
41
+ if (isMockWX(value)) {
42
+ uni.showToast({
43
+ icon: 'none',
44
+ title: '[DevTool] 请在小程序真机调试模式下查看源码',
45
+ });
46
+ return;
47
+ }
48
+
49
+ const isDev = props.mode === 'development';
50
+ const isUseDevSource = props.useDevSource;
51
+
52
+ // 非开发环境且未显式开启 useDevSource,不打开源码面板
53
+ if (!isDev && !isUseDevSource) return;
54
+
55
+ if (isAndroid()) {
56
+ if (props.sourceFileServers && props.sourceFileServers?.length > 0) {
57
+ openCode.value = true;
58
+ } else {
59
+ uni.showToast({
60
+ icon: 'none',
61
+ title: '[DevTool] sourceFileServers 配置异常',
62
+ });
63
+ }
64
+ } else {
65
+ openCode.value = true;
66
+ }
67
+ }
68
+
69
+ function onOpenJson(data?: { title?: string; data: Record<string, any> }) {
70
+ showJsonDetail.value = true;
71
+ jsonData.value = data;
72
+ }
73
+ function onCloseJson() {
74
+ showJsonDetail.value = false;
75
+ jsonData.value = undefined;
76
+ }
77
+
78
+ function onOpenNfcTool() {
79
+ showNfcTool.value = true;
80
+ }
81
+ function onCloseNfcTool() {
82
+ showNfcTool.value = false;
83
+ }
84
+
85
+ function onOpenBluetoothTool(device: DevTool.BluetoothItem) {
86
+ bluetoothDevice.value = device;
87
+ showBluetoothTool.value = true;
88
+ }
89
+ function onCloseBluetoothTool() {
90
+ showBluetoothTool.value = false;
91
+ bluetoothDevice.value = null;
92
+ }
93
+
94
+ function onOpenNetworkDetail(ni?: DevTool.NetworkItem) {
95
+ Object.assign(network, emptyNetwork);
96
+ Object.assign(network, ni);
97
+ showNetworkDetail.value = true;
98
+ }
99
+ function onCloseNetworkDetail() {
100
+ showNetworkDetail.value = false;
101
+ }
102
+
103
+ function onOpenNetworkSend(ni?: DevTool.NetworkItem) {
104
+ Object.assign(network, emptyNetwork);
105
+ Object.assign(network, ni);
106
+ showNetworkSend.value = true;
107
+ }
108
+ function onCloseNetworkSend() {
109
+ showNetworkSend.value = false;
110
+ }
111
+
112
+ function onOpenNetworkIntercept() {
113
+ showNetworkIntercept.value = true;
114
+ }
115
+ function onCloseNetworkIntercept() {
116
+ showNetworkIntercept.value = false;
117
+ }
118
+
119
+ function onOpenInterceptConfig(ni?: DevTool.NetworkItem) {
120
+ Object.assign(network, emptyNetwork);
121
+ if (ni) Object.assign(network, ni);
122
+ showInterceptConfig.value = true;
123
+ }
124
+ function onCloseInterceptConfig() {
125
+ showInterceptConfig.value = false;
126
+ }
127
+
128
+ function onOpenTransferDetail(item?: DevTool.TransferItem) {
129
+ if ((item as any).formData) {
130
+ delete (transfer as any).formData;
131
+ }
132
+ if ((item as any).filePath) {
133
+ delete (transfer as any).filePath;
134
+ }
135
+ Object.assign(transfer, item);
136
+ showTransferDetail.value = true;
137
+ }
138
+ function onCloseTransferDetail() {
139
+ showTransferDetail.value = false;
140
+ }
141
+
142
+ function onOpenWebSocketDetail(ws?: DevTool.WS, currentWebSocket?: any) {
143
+ Object.assign(webSocket, ws);
144
+ nextTick(() => {
145
+ // 兼容直接传入对象或传入 Ref 的情况
146
+ if (
147
+ currentWebSocket === undefined ||
148
+ currentWebSocket?.value ||
149
+ currentWebSocket
150
+ ) {
151
+ showWebSocketDetail.value = true;
152
+ }
153
+ });
154
+ }
155
+ function onCloseWebSocketDetail() {
156
+ showWebSocketDetail.value = false;
157
+ }
158
+
159
+ return {
160
+ state: reactive({
161
+ openCode,
162
+ stack,
163
+ showNetworkSend,
164
+ showNetworkDetail,
165
+ showNetworkIntercept,
166
+ showInterceptConfig,
167
+ showJsonDetail,
168
+ jsonData,
169
+ showNfcTool,
170
+ showTransferDetail,
171
+ showWebSocketDetail,
172
+ showBluetoothTool,
173
+ bluetoothDevice,
174
+ }),
175
+ network,
176
+ transfer,
177
+ webSocket,
178
+ handlers: {
179
+ onCloseCode,
180
+ onOpenCode,
181
+ onOpenJson,
182
+ onCloseJson,
183
+ onOpenNfcTool,
184
+ onCloseNfcTool,
185
+ onOpenNetworkDetail,
186
+ onCloseNetworkDetail,
187
+ onOpenNetworkSend,
188
+ onCloseNetworkSend,
189
+ onOpenNetworkIntercept,
190
+ onCloseNetworkIntercept,
191
+ onOpenInterceptConfig,
192
+ onCloseInterceptConfig,
193
+ onOpenTransferDetail,
194
+ onCloseTransferDetail,
195
+ onOpenWebSocketDetail,
196
+ onCloseWebSocketDetail,
197
+ onOpenBluetoothTool,
198
+ onCloseBluetoothTool,
199
+ },
200
+ };
201
+ }
@@ -1,105 +1,105 @@
1
- <template>
2
- <view class="el-event-item" @click.stop="onOpenJSon">
3
- <!-- <view class="el-event-item-row"> {{ eventItem.eventName }} </view> -->
4
- <view class="el-event-item-row">
5
- <Tag mode="main" v-if="eventItem.type == 'click'">
6
- {{ eventItem.type }}
7
- </Tag>
8
- <Tag mode="main" v-else-if="eventItem.type == 'tap'">
9
- {{ eventItem.type }}
10
- </Tag>
11
- <Tag mode="success" v-else-if="eventItem.type == 'touchstart'">
12
- {{ eventItem.type }}
13
- </Tag>
14
- <Tag mode="warn" v-else-if="eventItem.type == 'touchmove'">
15
- {{ eventItem.type }}
16
- </Tag>
17
- <Tag mode="error" v-else-if="eventItem.type == 'touchend'">
18
- {{ eventItem.type }}
19
- </Tag>
20
- <Tag mode="main" v-else>
21
- {{ eventItem.type }}
22
- </Tag>
23
-
24
- <view class="el-event-item-right">
25
- {{
26
- eventItem.timer
27
- ? formatDate(eventItem.timer, 'YYYY-MM-DD HH:mm:SS')
28
- : ''
29
- }}
30
- </view>
31
- </view>
32
-
33
- <view class="el-event-item-page">{{ eventItem?.path }}</view>
34
-
35
- <view
36
- class="el-event-item-position"
37
- v-for="(point, index) in eventItem.touches"
38
- :key="index">
39
- <view>cx:{{ point.clientX }}</view>
40
- <view>cy:{{ point.clientY }}</view>
41
- <view>px:{{ point.pageX }}</view>
42
- <view>py:{{ point.pageY }}</view>
43
- </view>
44
- </view>
45
- </template>
46
- <script lang="ts" setup>
47
- import Tag from '../../../components/Tag/index.vue';
48
- import type { DevTool } from '../../../../type';
49
- import { formatDate } from '../../../../utils';
50
-
51
- const props = defineProps<{
52
- eventItem: DevTool.ElEventItem;
53
- }>();
54
-
55
- const emit = defineEmits<{
56
- (e: 'openJson', value?: { title?: string; data: Record<string, any> }): void;
57
- }>();
58
-
59
- function onOpenJSon() {
60
- emit('openJson', {
61
- title: '事件详情',
62
- data: props.eventItem,
63
- });
64
- }
65
- </script>
66
-
67
- <style scoped>
68
- .el-event-item {
69
- padding: 16px;
70
- border-bottom: 1px solid var(--dev-tool-border-color);
71
- box-sizing: border-box;
72
- }
73
-
74
- .el-event-item-row {
75
- display: flex;
76
- align-items: center;
77
- justify-content: space-between;
78
- height: 28px;
79
- word-break: break-all;
80
- }
81
-
82
- .el-event-item-right {
83
- text-align: right;
84
- word-break: break-all;
85
- }
86
-
87
- .link {
88
- cursor: pointer;
89
- text-decoration: underline;
90
- }
91
-
92
- .el-event-item-page {
93
- text-align: right;
94
- }
95
-
96
- .el-event-item-position {
97
- display: flex;
98
- align-items: center;
99
- min-height: 24px;
100
- }
101
-
102
- .el-event-item-position > view {
103
- width: 25%;
104
- }
105
- </style>
1
+ <template>
2
+ <view class="el-event-item" @click.stop="onOpenJSon">
3
+ <!-- <view class="el-event-item-row"> {{ eventItem.eventName }} </view> -->
4
+ <view class="el-event-item-row">
5
+ <Tag mode="main" v-if="eventItem.type == 'click'">
6
+ {{ eventItem.type }}
7
+ </Tag>
8
+ <Tag mode="main" v-else-if="eventItem.type == 'tap'">
9
+ {{ eventItem.type }}
10
+ </Tag>
11
+ <Tag mode="success" v-else-if="eventItem.type == 'touchstart'">
12
+ {{ eventItem.type }}
13
+ </Tag>
14
+ <Tag mode="warn" v-else-if="eventItem.type == 'touchmove'">
15
+ {{ eventItem.type }}
16
+ </Tag>
17
+ <Tag mode="error" v-else-if="eventItem.type == 'touchend'">
18
+ {{ eventItem.type }}
19
+ </Tag>
20
+ <Tag mode="main" v-else>
21
+ {{ eventItem.type }}
22
+ </Tag>
23
+
24
+ <view class="el-event-item-right">
25
+ {{
26
+ eventItem.timer
27
+ ? formatDate(eventItem.timer, 'YYYY-MM-DD HH:mm:SS')
28
+ : ''
29
+ }}
30
+ </view>
31
+ </view>
32
+
33
+ <view class="el-event-item-page">{{ eventItem?.path }}</view>
34
+
35
+ <view
36
+ class="el-event-item-position"
37
+ v-for="(point, index) in eventItem.touches"
38
+ :key="index">
39
+ <view>cx:{{ point.clientX }}</view>
40
+ <view>cy:{{ point.clientY }}</view>
41
+ <view>px:{{ point.pageX }}</view>
42
+ <view>py:{{ point.pageY }}</view>
43
+ </view>
44
+ </view>
45
+ </template>
46
+ <script lang="ts" setup>
47
+ import Tag from '../../../components/Tag/index.vue';
48
+ import type { DevTool } from '../../../../type';
49
+ import { formatDate } from '../../../../utils';
50
+
51
+ const props = defineProps<{
52
+ eventItem: DevTool.ElEventItem;
53
+ }>();
54
+
55
+ const emit = defineEmits<{
56
+ (e: 'openJson', value?: { title?: string; data: Record<string, any> }): void;
57
+ }>();
58
+
59
+ function onOpenJSon() {
60
+ emit('openJson', {
61
+ title: '事件详情',
62
+ data: props.eventItem,
63
+ });
64
+ }
65
+ </script>
66
+
67
+ <style scoped>
68
+ .el-event-item {
69
+ padding: 16px;
70
+ border-bottom: 1px solid var(--dev-tool-border-color);
71
+ box-sizing: border-box;
72
+ }
73
+
74
+ .el-event-item-row {
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: space-between;
78
+ height: 28px;
79
+ word-break: break-all;
80
+ }
81
+
82
+ .el-event-item-right {
83
+ text-align: right;
84
+ word-break: break-all;
85
+ }
86
+
87
+ .link {
88
+ cursor: pointer;
89
+ text-decoration: underline;
90
+ }
91
+
92
+ .el-event-item-page {
93
+ text-align: right;
94
+ }
95
+
96
+ .el-event-item-position {
97
+ display: flex;
98
+ align-items: center;
99
+ min-height: 24px;
100
+ }
101
+
102
+ .el-event-item-position > view {
103
+ width: 25%;
104
+ }
105
+ </style>