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