oxy-uni-ui 2.1.1 → 2.1.2
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/attributes.json +1 -1
- package/components/common/abstracts/variable.scss +13 -2
- package/components/oxy-checkbox/index.scss +37 -2
- package/components/oxy-sort-button/index.scss +3 -4
- package/components/oxy-tag/index.scss +157 -17
- package/components/oxy-tag/oxy-tag.vue +14 -2
- package/components/oxy-tag/types.ts +9 -0
- package/dev-tools.ts +2 -0
- package/devTools/components/DevToolsOverlay.vue +56 -0
- package/devTools/components/DevToolsUiHost.vue +589 -0
- package/devTools/config.js +55 -0
- package/devTools/core/components/mpDevBubble.vue +174 -0
- package/devTools/core/libs/createH5Bubble.js +156 -0
- package/devTools/core/libs/devCache.js +151 -0
- package/devTools/core/libs/devOptions.js +163 -0
- package/devTools/core/libs/devUi.js +219 -0
- package/devTools/core/libs/drawView.js +140 -0
- package/devTools/core/libs/errorReport.js +64 -0
- package/devTools/core/libs/jsonCompress.js +334 -0
- package/devTools/core/libs/logReport.js +59 -0
- package/devTools/core/libs/pageLinkList.js +125 -0
- package/devTools/core/libs/timeFormat.js +94 -0
- package/devTools/core/proxy/console.js +430 -0
- package/devTools/core/proxy/index.js +36 -0
- package/devTools/core/proxy/request.js +495 -0
- package/devTools/core/proxy/storage.js +113 -0
- package/devTools/core/proxy/uniBus.js +153 -0
- package/devTools/core/proxy/uniListen.js +192 -0
- package/devTools/core/proxy/vueMixin.js +120 -0
- package/devTools/index.js +168 -0
- package/devTools/page/components/bottomTools.vue +1046 -0
- package/devTools/page/components/dialog/addStorage.vue +204 -0
- package/devTools/page/components/dialog/createDir.vue +366 -0
- package/devTools/page/components/dialog/editDialog.vue +192 -0
- package/devTools/page/components/dialog/routeDialog.vue +184 -0
- package/devTools/page/components/dialog/sendRequest.vue +603 -0
- package/devTools/page/components/dialog/textFileEditDialog.vue +391 -0
- package/devTools/page/components/libs/appDelDir.js +86 -0
- package/devTools/page/components/libs/dirReader.js +248 -0
- package/devTools/page/components/libs/fileSize.js +15 -0
- package/devTools/page/components/libs/getRuntimeInfo.js +134 -0
- package/devTools/page/components/listItem/consoleItem.vue +314 -0
- package/devTools/page/components/listItem/errorItem.vue +292 -0
- package/devTools/page/components/listItem/fileSysItem.vue +533 -0
- package/devTools/page/components/listItem/infoList.vue +100 -0
- package/devTools/page/components/listItem/jsRunnerItem.vue +255 -0
- package/devTools/page/components/listItem/logItem.vue +193 -0
- package/devTools/page/components/listItem/networkItem.vue +398 -0
- package/devTools/page/components/listItem/objectAnalysis.vue +651 -0
- package/devTools/page/components/listItem/pages.vue +319 -0
- package/devTools/page/components/listItem/routeItem.vue +153 -0
- package/devTools/page/components/listItem/setting.vue +734 -0
- package/devTools/page/components/listItem/storageList.vue +681 -0
- package/devTools/page/components/listItem/tools.vue +315 -0
- package/devTools/page/components/listItem/vuexList.vue +599 -0
- package/devTools/page/components/main.vue +1867 -0
- package/devTools/page/components/mixins/animationControl.js +91 -0
- package/devTools/page/components/mixins/mp.js +83 -0
- package/devTools/page/components/ui/btnTabs.vue +90 -0
- package/devTools/page/components/ui/codeHisPicker.vue +172 -0
- package/devTools/page/components/ui/h5Cell.vue +13 -0
- package/devTools/page/components/ui/menuBtn.vue +94 -0
- package/devTools/page/components/ui/mobileSwiperScroll.vue +74 -0
- package/devTools/page/components/ui/requestSpeedLimit.vue +52 -0
- package/devTools/page/components/ui/requestTimeoutMock.vue +55 -0
- package/devTools/page/components/ui/subTitleBar.vue +101 -0
- package/devTools/page/static/copy.png +0 -0
- package/devTools/page/static/delete.png +0 -0
- package/devTools/page/static/fileSys/AI.png +0 -0
- package/devTools/page/static/fileSys/DWG.png +0 -0
- package/devTools/page/static/fileSys/EXE.png +0 -0
- package/devTools/page/static/fileSys/GIF.png +0 -0
- package/devTools/page/static/fileSys/HTML.png +0 -0
- package/devTools/page/static/fileSys/PSD.png +0 -0
- package/devTools/page/static/fileSys/RVT.png +0 -0
- package/devTools/page/static/fileSys/SKP.png +0 -0
- package/devTools/page/static/fileSys/SVG.png +0 -0
- package/devTools/page/static/fileSys/excel.png +0 -0
- package/devTools/page/static/fileSys/pdf.png +0 -0
- package/devTools/page/static/fileSys/pptl.png +0 -0
- package/devTools/page/static/fileSys/shipin.png +0 -0
- package/devTools/page/static/fileSys/tupian.png +0 -0
- package/devTools/page/static/fileSys/txt.png +0 -0
- package/devTools/page/static/fileSys/weizhiwenjian.png +0 -0
- package/devTools/page/static/fileSys/wenjianjia.png +0 -0
- package/devTools/page/static/fileSys/word.png +0 -0
- package/devTools/page/static/fileSys/yasuo.png +0 -0
- package/devTools/page/static/fileSys/yinpin.png +0 -0
- package/devTools/page/static/fold.png +0 -0
- package/devTools/page/static/menu.png +0 -0
- package/devTools/page/static/refresh.png +0 -0
- package/devTools/page/static/unfold.png +0 -0
- package/devTools/tools.vue +25 -0
- package/devTools/type/devTools.d.ts +406 -0
- package/oxy-dev-tools/components/DevToolsUiHost.vue +555 -0
- package/oxy-dev-tools/config.js +61 -0
- package/oxy-dev-tools/core/components/mpDevBubble.vue +176 -0
- package/oxy-dev-tools/core/libs/createH5Bubble.js +156 -0
- package/oxy-dev-tools/core/libs/devCache.js +149 -0
- package/oxy-dev-tools/core/libs/devOptions.js +160 -0
- package/oxy-dev-tools/core/libs/devUi.js +219 -0
- package/oxy-dev-tools/core/libs/drawView.js +144 -0
- package/oxy-dev-tools/core/libs/errorReport.js +60 -0
- package/oxy-dev-tools/core/libs/jsonCompress.js +328 -0
- package/oxy-dev-tools/core/libs/logReport.js +55 -0
- package/oxy-dev-tools/core/libs/pageLinkList.js +121 -0
- package/oxy-dev-tools/core/libs/timeFormat.js +93 -0
- package/oxy-dev-tools/core/proxy/console.js +398 -0
- package/oxy-dev-tools/core/proxy/index.js +33 -0
- package/oxy-dev-tools/core/proxy/request.js +473 -0
- package/oxy-dev-tools/core/proxy/storage.js +96 -0
- package/oxy-dev-tools/core/proxy/uniBus.js +148 -0
- package/oxy-dev-tools/core/proxy/uniListen.js +190 -0
- package/oxy-dev-tools/core/proxy/vueMixin.js +115 -0
- package/oxy-dev-tools/index.ts +183 -0
- package/oxy-dev-tools/oxy-dev-tools.vue +62 -0
- package/oxy-dev-tools/page/components/bottomTools.vue +933 -0
- package/oxy-dev-tools/page/components/dialog/addStorage.vue +184 -0
- package/oxy-dev-tools/page/components/dialog/createDir.vue +352 -0
- package/oxy-dev-tools/page/components/dialog/editDialog.vue +178 -0
- package/oxy-dev-tools/page/components/dialog/routeDialog.vue +170 -0
- package/oxy-dev-tools/page/components/dialog/sendRequest.vue +530 -0
- package/oxy-dev-tools/page/components/dialog/textFileEditDialog.vue +379 -0
- package/oxy-dev-tools/page/components/libs/appDelDir.js +77 -0
- package/oxy-dev-tools/page/components/libs/dirReader.js +239 -0
- package/oxy-dev-tools/page/components/libs/fileSize.js +15 -0
- package/oxy-dev-tools/page/components/libs/getRuntimeInfo.js +132 -0
- package/oxy-dev-tools/page/components/listItem/consoleItem.vue +292 -0
- package/oxy-dev-tools/page/components/listItem/errorItem.vue +268 -0
- package/oxy-dev-tools/page/components/listItem/fileSysItem.vue +511 -0
- package/oxy-dev-tools/page/components/listItem/infoList.vue +89 -0
- package/oxy-dev-tools/page/components/listItem/jsRunnerItem.vue +236 -0
- package/oxy-dev-tools/page/components/listItem/logItem.vue +185 -0
- package/oxy-dev-tools/page/components/listItem/networkItem.vue +362 -0
- package/oxy-dev-tools/page/components/listItem/objectAnalysis.vue +642 -0
- package/oxy-dev-tools/page/components/listItem/pages.vue +285 -0
- package/oxy-dev-tools/page/components/listItem/routeItem.vue +140 -0
- package/oxy-dev-tools/page/components/listItem/setting.vue +687 -0
- package/oxy-dev-tools/page/components/listItem/storageList.vue +623 -0
- package/oxy-dev-tools/page/components/listItem/tools.vue +273 -0
- package/oxy-dev-tools/page/components/listItem/vuexList.vue +559 -0
- package/oxy-dev-tools/page/components/main.vue +1824 -0
- package/oxy-dev-tools/page/components/mixins/animationControl.js +80 -0
- package/oxy-dev-tools/page/components/mixins/mp.js +76 -0
- package/oxy-dev-tools/page/components/ui/btnTabs.vue +77 -0
- package/oxy-dev-tools/page/components/ui/codeHisPicker.vue +161 -0
- package/oxy-dev-tools/page/components/ui/h5Cell.vue +13 -0
- package/oxy-dev-tools/page/components/ui/menuBtn.vue +87 -0
- package/oxy-dev-tools/page/components/ui/mobileSwiperScroll.vue +71 -0
- package/oxy-dev-tools/page/components/ui/requestSpeedLimit.vue +47 -0
- package/oxy-dev-tools/page/components/ui/requestTimeoutMock.vue +50 -0
- package/oxy-dev-tools/page/components/ui/subTitleBar.vue +87 -0
- package/oxy-dev-tools/page/static/copy.png +0 -0
- package/oxy-dev-tools/page/static/delete.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/AI.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/DWG.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/EXE.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/GIF.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/HTML.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/PSD.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/RVT.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/SKP.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/SVG.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/excel.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/pdf.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/pptl.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/shipin.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/tupian.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/txt.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/weizhiwenjian.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/wenjianjia.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/word.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/yasuo.png +0 -0
- package/oxy-dev-tools/page/static/fileSys/yinpin.png +0 -0
- package/oxy-dev-tools/page/static/fold.png +0 -0
- package/oxy-dev-tools/page/static/menu.png +0 -0
- package/oxy-dev-tools/page/static/refresh.png +0 -0
- package/oxy-dev-tools/page/static/unfold.png +0 -0
- package/oxy-dev-tools/tools.vue +22 -0
- package/oxy-dev-tools/type/devTools.d.ts +406 -0
- package/package.json +1 -1
- package/tags.json +1 -1
- package/web-types.json +1 -1
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="vuexList">
|
|
3
|
+
<view v-if="!isLoaded" class="dataLoading">
|
|
4
|
+
<text class="status">加载中</text>
|
|
5
|
+
</view>
|
|
6
|
+
|
|
7
|
+
<view v-else-if="isEmpty" class="dataLoading">
|
|
8
|
+
<text class="status">暂无状态数据</text>
|
|
9
|
+
</view>
|
|
10
|
+
|
|
11
|
+
<template v-else>
|
|
12
|
+
<view v-for="(item, index) in stateRows" :key="`${item.key}_${index}`" class="stateRow" @click="openValueViewer(item)">
|
|
13
|
+
<view class="section keySection">
|
|
14
|
+
<text class="sectionLabel">KEY</text>
|
|
15
|
+
<view class="keyContentRow">
|
|
16
|
+
<text class="keyText">{{ item.key }}</text>
|
|
17
|
+
<view class="detailBtn" @click.stop="openValueViewer(item)">
|
|
18
|
+
<text class="detailBtnText">查看详情</text>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
|
|
23
|
+
<view class="sectionDivider" />
|
|
24
|
+
|
|
25
|
+
<view class="section valueSection">
|
|
26
|
+
<text class="sectionLabel">VALUE</text>
|
|
27
|
+
<text class="sectionText valueText">{{ item.preview }}</text>
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<view v-if="valueViewer.show" class="valueViewerMask" @click="closeValueViewer">
|
|
33
|
+
<view class="valueViewerCard" @click.stop>
|
|
34
|
+
<view class="viewerHead">
|
|
35
|
+
<text class="viewerTitle">键值详情</text>
|
|
36
|
+
<text class="viewerClose" @click.stop="closeValueViewer">×</text>
|
|
37
|
+
</view>
|
|
38
|
+
|
|
39
|
+
<view class="viewerSection">
|
|
40
|
+
<view class="viewerKeyRow">
|
|
41
|
+
<text class="sectionLabel">KEY</text>
|
|
42
|
+
<text class="viewerKey">{{ valueViewer.key }}</text>
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
|
|
46
|
+
<view class="viewerSection">
|
|
47
|
+
<text class="sectionLabel">VALUE</text>
|
|
48
|
+
<scroll-view scroll-y class="viewerBody">
|
|
49
|
+
<text class="viewerText">{{ valueViewer.fullText }}</text>
|
|
50
|
+
</scroll-view>
|
|
51
|
+
</view>
|
|
52
|
+
|
|
53
|
+
<view class="viewerActions">
|
|
54
|
+
<view class="viewerBtn" @click.stop="copyViewerValue">
|
|
55
|
+
<text class="viewerBtnText">复制</text>
|
|
56
|
+
</view>
|
|
57
|
+
|
|
58
|
+
<view v-if="valueViewer.canEdit" class="viewerBtn" @click.stop="editViewerValue">
|
|
59
|
+
<text class="viewerBtnText">编辑</text>
|
|
60
|
+
</view>
|
|
61
|
+
</view>
|
|
62
|
+
</view>
|
|
63
|
+
</view>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
|
|
67
|
+
<script>
|
|
68
|
+
import devUi from '../../../core/libs/devUi.js'
|
|
69
|
+
|
|
70
|
+
function isPrimitiveEditable(value) {
|
|
71
|
+
const vType = typeof value
|
|
72
|
+
return value === null || vType === 'string' || vType === 'number' || vType === 'boolean' || vType === 'undefined'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
props: {
|
|
77
|
+
/**
|
|
78
|
+
* 全局变量类型
|
|
79
|
+
*/
|
|
80
|
+
stateType: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'vuex'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
isLoaded: false,
|
|
88
|
+
isEmpty: false,
|
|
89
|
+
stateRows: [],
|
|
90
|
+
loadToken: 0,
|
|
91
|
+
maxPreviewLength: 120,
|
|
92
|
+
valueViewer: {
|
|
93
|
+
show: false,
|
|
94
|
+
key: '',
|
|
95
|
+
fullText: '',
|
|
96
|
+
path: [],
|
|
97
|
+
canEdit: false
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
mounted() {
|
|
102
|
+
this.getData()
|
|
103
|
+
},
|
|
104
|
+
beforeUnmount() {
|
|
105
|
+
this.loadToken += 1
|
|
106
|
+
uni.$emit('devTools_valueViewer_hide')
|
|
107
|
+
},
|
|
108
|
+
watch: {
|
|
109
|
+
stateType() {
|
|
110
|
+
this.getData()
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
/**
|
|
115
|
+
* 加载数据
|
|
116
|
+
*/
|
|
117
|
+
async getData() {
|
|
118
|
+
const loadToken = ++this.loadToken
|
|
119
|
+
this.isLoaded = false
|
|
120
|
+
this.isEmpty = false
|
|
121
|
+
|
|
122
|
+
const snapshot = this.getStateSnapshot()
|
|
123
|
+
if (loadToken !== this.loadToken) {
|
|
124
|
+
return false
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
this.stateRows = this.buildStateRows(snapshot)
|
|
128
|
+
this.isEmpty = this.stateRows.length === 0
|
|
129
|
+
this.isLoaded = true
|
|
130
|
+
this.closeValueViewer()
|
|
131
|
+
return true
|
|
132
|
+
},
|
|
133
|
+
getStateSnapshot() {
|
|
134
|
+
let data = {}
|
|
135
|
+
if (this.stateType == 'vuex') {
|
|
136
|
+
try {
|
|
137
|
+
data = JSON.parse(JSON.stringify(this.$store.state))
|
|
138
|
+
} catch (error) {}
|
|
139
|
+
} else if (this.stateType == 'pinia') {
|
|
140
|
+
try {
|
|
141
|
+
if (uni.Pinia) {
|
|
142
|
+
data = JSON.parse(JSON.stringify(uni.Pinia.getActivePinia().state.value))
|
|
143
|
+
} else if (this.$pinia) {
|
|
144
|
+
data = JSON.parse(JSON.stringify(this.$pinia.state.value))
|
|
145
|
+
}
|
|
146
|
+
} catch (error) {}
|
|
147
|
+
} else if (this.stateType == 'globalData') {
|
|
148
|
+
try {
|
|
149
|
+
data = JSON.parse(JSON.stringify(getApp().globalData))
|
|
150
|
+
} catch (error) {}
|
|
151
|
+
}
|
|
152
|
+
return data
|
|
153
|
+
},
|
|
154
|
+
getMutableStateRoot() {
|
|
155
|
+
if (this.stateType == 'vuex') {
|
|
156
|
+
return this.$store ? this.$store.state : null
|
|
157
|
+
}
|
|
158
|
+
if (this.stateType == 'pinia') {
|
|
159
|
+
if (uni.Pinia) {
|
|
160
|
+
return uni.Pinia.getActivePinia().state.value
|
|
161
|
+
}
|
|
162
|
+
if (this.$pinia) {
|
|
163
|
+
return this.$pinia.state.value
|
|
164
|
+
}
|
|
165
|
+
return null
|
|
166
|
+
}
|
|
167
|
+
if (this.stateType == 'globalData') {
|
|
168
|
+
try {
|
|
169
|
+
return getApp().globalData
|
|
170
|
+
} catch (error) {
|
|
171
|
+
return null
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null
|
|
175
|
+
},
|
|
176
|
+
buildStateRows(data) {
|
|
177
|
+
if (!data || typeof data != 'object') {
|
|
178
|
+
return []
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const keys = Reflect.ownKeys(data).filter((key) => typeof key != 'symbol')
|
|
182
|
+
return keys.map((key) => {
|
|
183
|
+
const value = data[key]
|
|
184
|
+
const fullText = this.stringifyValue(value, true)
|
|
185
|
+
return {
|
|
186
|
+
key: String(key),
|
|
187
|
+
path: [key],
|
|
188
|
+
value,
|
|
189
|
+
fullText,
|
|
190
|
+
preview: this.getPreviewText(fullText),
|
|
191
|
+
canEdit: isPrimitiveEditable(value)
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
},
|
|
195
|
+
getPreviewText(fullText) {
|
|
196
|
+
const singleLine = String(fullText || '')
|
|
197
|
+
.replace(/\s+/g, ' ')
|
|
198
|
+
.trim()
|
|
199
|
+
if (singleLine.length <= this.maxPreviewLength) {
|
|
200
|
+
return singleLine
|
|
201
|
+
}
|
|
202
|
+
return `${singleLine.slice(0, this.maxPreviewLength)}...`
|
|
203
|
+
},
|
|
204
|
+
stringifyValue(data, pretty = false) {
|
|
205
|
+
try {
|
|
206
|
+
if (data === undefined) return 'undefined'
|
|
207
|
+
if (data === null) return 'null'
|
|
208
|
+
if (typeof data == 'boolean') return data ? 'true' : 'false'
|
|
209
|
+
if (typeof data == 'number') {
|
|
210
|
+
if (Number.isFinite(data)) return String(data)
|
|
211
|
+
return isNaN(data) ? 'NaN' : 'Infinity'
|
|
212
|
+
}
|
|
213
|
+
if (typeof data == 'string') return data
|
|
214
|
+
if (typeof data == 'object') return JSON.stringify(data, null, pretty ? 2 : 0)
|
|
215
|
+
return data.toString()
|
|
216
|
+
} catch (error) {
|
|
217
|
+
return '尝试解析失败!' + error
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
openValueViewer(item) {
|
|
221
|
+
uni.$emit('devTools_valueViewer_show')
|
|
222
|
+
this.valueViewer = {
|
|
223
|
+
show: true,
|
|
224
|
+
key: item.key,
|
|
225
|
+
fullText: item.fullText,
|
|
226
|
+
path: item.path || [],
|
|
227
|
+
canEdit: item.canEdit === true
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
closeValueViewer() {
|
|
231
|
+
if (this.valueViewer.show) {
|
|
232
|
+
uni.$emit('devTools_valueViewer_hide')
|
|
233
|
+
}
|
|
234
|
+
this.valueViewer = {
|
|
235
|
+
...this.valueViewer,
|
|
236
|
+
show: false
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
copyViewerValue() {
|
|
240
|
+
if (!this.valueViewer.show) {
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
this.copyToClipboard(this.buildCopyText(this.valueViewer.key, this.valueViewer.fullText))
|
|
244
|
+
},
|
|
245
|
+
copyToClipboard(data) {
|
|
246
|
+
uni.setClipboardData({
|
|
247
|
+
data,
|
|
248
|
+
success: () => {
|
|
249
|
+
devUi.showToast({
|
|
250
|
+
icon: 'success',
|
|
251
|
+
title: '复制成功'
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
},
|
|
256
|
+
buildCopyText(key, valueText) {
|
|
257
|
+
return `KEY: ${key}\nVALUE:\n${valueText}`
|
|
258
|
+
},
|
|
259
|
+
editViewerValue() {
|
|
260
|
+
if (!this.valueViewer.show || !this.valueViewer.canEdit) {
|
|
261
|
+
return
|
|
262
|
+
}
|
|
263
|
+
const row = this.stateRows.find((x) => x.key === this.valueViewer.key)
|
|
264
|
+
if (!row) {
|
|
265
|
+
this.closeValueViewer()
|
|
266
|
+
return
|
|
267
|
+
}
|
|
268
|
+
this.closeValueViewer()
|
|
269
|
+
this.editStateValue(row)
|
|
270
|
+
},
|
|
271
|
+
getValueByPath(root, path) {
|
|
272
|
+
let cursor = root
|
|
273
|
+
for (let i = 0; i < path.length; i++) {
|
|
274
|
+
if (!cursor || typeof cursor != 'object') {
|
|
275
|
+
return undefined
|
|
276
|
+
}
|
|
277
|
+
cursor = cursor[path[i]]
|
|
278
|
+
}
|
|
279
|
+
return cursor
|
|
280
|
+
},
|
|
281
|
+
setValueByPath(root, path, val) {
|
|
282
|
+
if (!root || typeof root != 'object' || !Array.isArray(path) || path.length == 0) {
|
|
283
|
+
return false
|
|
284
|
+
}
|
|
285
|
+
let cursor = root
|
|
286
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
287
|
+
if (!cursor || typeof cursor != 'object') {
|
|
288
|
+
return false
|
|
289
|
+
}
|
|
290
|
+
cursor = cursor[path[i]]
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (!cursor || typeof cursor != 'object') {
|
|
294
|
+
return false
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const lastKey = path[path.length - 1]
|
|
298
|
+
if (this.$set) {
|
|
299
|
+
this.$set(cursor, lastKey, val)
|
|
300
|
+
} else {
|
|
301
|
+
cursor[lastKey] = val
|
|
302
|
+
}
|
|
303
|
+
return true
|
|
304
|
+
},
|
|
305
|
+
editStateValue(item) {
|
|
306
|
+
const root = this.getMutableStateRoot()
|
|
307
|
+
if (!root || !item || !item.path || item.path.length == 0) {
|
|
308
|
+
this.getData()
|
|
309
|
+
return
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const oldValue = this.getValueByPath(root, item.path)
|
|
313
|
+
const oldType = typeof oldValue
|
|
314
|
+
const isBool = oldType == 'boolean'
|
|
315
|
+
|
|
316
|
+
let value = oldValue
|
|
317
|
+
if (isBool) {
|
|
318
|
+
value = value ? 'true' : 'false'
|
|
319
|
+
} else if (value === undefined || value === null) {
|
|
320
|
+
value = ''
|
|
321
|
+
} else {
|
|
322
|
+
value = String(value)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
uni.$emit('devTools_showEditDialog', {
|
|
326
|
+
title: item.key,
|
|
327
|
+
value
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
uni.$on('devTools_editDialogClose', () => {
|
|
331
|
+
uni.$off('devTools_editDialogSaveSuccess')
|
|
332
|
+
uni.$off('devTools_editDialogClose')
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
uni.$on('devTools_editDialogSaveSuccess', (val) => {
|
|
336
|
+
uni.$off('devTools_editDialogSaveSuccess')
|
|
337
|
+
uni.$off('devTools_editDialogClose')
|
|
338
|
+
|
|
339
|
+
if (isBool && (val == 'true' || val == 'false')) {
|
|
340
|
+
val = val == 'true'
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
this.setValueByPath(root, item.path, val)
|
|
344
|
+
this.getData()
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
</script>
|
|
350
|
+
|
|
351
|
+
<style lang="scss" scoped>
|
|
352
|
+
.vuexList {
|
|
353
|
+
padding: 16rpx 20rpx;
|
|
354
|
+
width: 100%;
|
|
355
|
+
box-sizing: border-box;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.dataLoading {
|
|
359
|
+
width: 100%;
|
|
360
|
+
box-sizing: border-box;
|
|
361
|
+
height: 220rpx;
|
|
362
|
+
margin: 10rpx 0;
|
|
363
|
+
border-radius: 16rpx;
|
|
364
|
+
border: 1px solid rgba(148, 163, 184, 0.2);
|
|
365
|
+
background: #f8fafc;
|
|
366
|
+
display: flex;
|
|
367
|
+
flex-direction: row;
|
|
368
|
+
align-items: center;
|
|
369
|
+
justify-content: center;
|
|
370
|
+
|
|
371
|
+
.status {
|
|
372
|
+
font-size: 24rpx;
|
|
373
|
+
color: #64748b;
|
|
374
|
+
line-height: 34rpx;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.stateRow {
|
|
379
|
+
width: 100%;
|
|
380
|
+
box-sizing: border-box;
|
|
381
|
+
border-radius: 16rpx;
|
|
382
|
+
border: 1px solid rgba(148, 163, 184, 0.18);
|
|
383
|
+
background: #fff;
|
|
384
|
+
margin: 0 0 12rpx;
|
|
385
|
+
padding: 14rpx 16rpx;
|
|
386
|
+
box-shadow: 0 4rpx 12rpx rgba(15, 23, 42, 0.04);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.section {
|
|
390
|
+
display: flex;
|
|
391
|
+
flex-direction: column;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.sectionLabel {
|
|
395
|
+
font-size: 18rpx;
|
|
396
|
+
line-height: 24rpx;
|
|
397
|
+
color: #94a3b8;
|
|
398
|
+
letter-spacing: 1rpx;
|
|
399
|
+
text-transform: uppercase;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.sectionText {
|
|
403
|
+
margin-top: 6rpx;
|
|
404
|
+
word-break: break-all;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.keyText {
|
|
408
|
+
flex: 1;
|
|
409
|
+
font-size: 24rpx;
|
|
410
|
+
line-height: 32rpx;
|
|
411
|
+
color: #0f172a;
|
|
412
|
+
font-weight: 500;
|
|
413
|
+
word-break: break-all;
|
|
414
|
+
padding-right: 12rpx;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.keyContentRow {
|
|
418
|
+
margin-top: 6rpx;
|
|
419
|
+
display: flex;
|
|
420
|
+
flex-direction: row;
|
|
421
|
+
align-items: center;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.detailBtn {
|
|
425
|
+
height: 44rpx;
|
|
426
|
+
padding: 0 14rpx;
|
|
427
|
+
border-radius: 22rpx;
|
|
428
|
+
border: 1px solid rgba(59, 130, 246, 0.26);
|
|
429
|
+
background: #eff6ff;
|
|
430
|
+
display: flex;
|
|
431
|
+
flex-direction: row;
|
|
432
|
+
align-items: center;
|
|
433
|
+
justify-content: center;
|
|
434
|
+
flex-shrink: 0;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.detailBtnText {
|
|
438
|
+
font-size: 20rpx;
|
|
439
|
+
line-height: 28rpx;
|
|
440
|
+
color: #2563eb;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.sectionDivider {
|
|
444
|
+
margin: 10rpx 0;
|
|
445
|
+
height: 1px;
|
|
446
|
+
background: rgba(148, 163, 184, 0.22);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.valueText {
|
|
450
|
+
font-size: 22rpx;
|
|
451
|
+
line-height: 30rpx;
|
|
452
|
+
color: #334155;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.valueViewerMask {
|
|
456
|
+
position: fixed;
|
|
457
|
+
left: 0;
|
|
458
|
+
right: 0;
|
|
459
|
+
top: var(--devtools-panel-top, 40vh);
|
|
460
|
+
bottom: 0;
|
|
461
|
+
background: rgba(15, 23, 42, 0.45);
|
|
462
|
+
z-index: 20;
|
|
463
|
+
display: flex;
|
|
464
|
+
align-items: center;
|
|
465
|
+
justify-content: center;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.valueViewerCard {
|
|
469
|
+
width: 700rpx;
|
|
470
|
+
max-height: calc(var(--devtools-panel-height, 60vh) - 40rpx);
|
|
471
|
+
border-radius: 16rpx;
|
|
472
|
+
background: #fff;
|
|
473
|
+
border: 1px solid rgba(148, 163, 184, 0.25);
|
|
474
|
+
padding: 14rpx;
|
|
475
|
+
display: flex;
|
|
476
|
+
flex-direction: column;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.viewerHead {
|
|
480
|
+
display: flex;
|
|
481
|
+
align-items: center;
|
|
482
|
+
justify-content: space-between;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.viewerTitle {
|
|
486
|
+
flex: 1;
|
|
487
|
+
font-size: 24rpx;
|
|
488
|
+
line-height: 32rpx;
|
|
489
|
+
color: #0f172a;
|
|
490
|
+
font-weight: 500;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.viewerClose {
|
|
494
|
+
width: 44rpx;
|
|
495
|
+
text-align: center;
|
|
496
|
+
font-size: 42rpx;
|
|
497
|
+
line-height: 32rpx;
|
|
498
|
+
color: #64748b;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.viewerSection {
|
|
502
|
+
margin-top: 12rpx;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.viewerKey {
|
|
506
|
+
margin-left: 10rpx;
|
|
507
|
+
font-size: 22rpx;
|
|
508
|
+
line-height: 32rpx;
|
|
509
|
+
color: #0f172a;
|
|
510
|
+
word-break: break-all;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.viewerKeyRow {
|
|
514
|
+
margin-top: 6rpx;
|
|
515
|
+
display: flex;
|
|
516
|
+
flex-direction: row;
|
|
517
|
+
align-items: center;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.viewerBody {
|
|
521
|
+
margin-top: 8rpx;
|
|
522
|
+
height: 560rpx;
|
|
523
|
+
padding: 10rpx;
|
|
524
|
+
background: #f8fafc;
|
|
525
|
+
border-radius: 10rpx;
|
|
526
|
+
border: 1px solid rgba(148, 163, 184, 0.16);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.viewerText {
|
|
530
|
+
font-size: 22rpx;
|
|
531
|
+
line-height: 32rpx;
|
|
532
|
+
color: #334155;
|
|
533
|
+
word-break: break-all;
|
|
534
|
+
white-space: pre-wrap;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.viewerActions {
|
|
538
|
+
margin-top: 12rpx;
|
|
539
|
+
display: flex;
|
|
540
|
+
justify-content: flex-end;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.viewerBtn {
|
|
544
|
+
min-width: 108rpx;
|
|
545
|
+
height: 56rpx;
|
|
546
|
+
border-radius: 10rpx;
|
|
547
|
+
background: #f1f5f9;
|
|
548
|
+
border: 1px solid rgba(148, 163, 184, 0.25);
|
|
549
|
+
display: flex;
|
|
550
|
+
align-items: center;
|
|
551
|
+
justify-content: center;
|
|
552
|
+
margin-left: 8rpx;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.viewerBtnText {
|
|
556
|
+
font-size: 22rpx;
|
|
557
|
+
color: #334155;
|
|
558
|
+
}
|
|
559
|
+
</style>
|