@we-debug/miniprogram 0.49.1 → 0.50.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.
- package/CHANGELOG.md +20 -0
- package/dist/api-view/index.js +277 -0
- package/dist/api-view/index.json +6 -0
- package/dist/api-view/index.less +1 -0
- package/dist/api-view/index.wxml +154 -0
- package/dist/api-view/index.wxss +592 -0
- package/dist/api-view/utils.js +90 -0
- package/dist/index/index.js +9 -2
- package/dist/index/index.json +2 -0
- package/dist/index/index.wxml +11 -1
- package/dist/json-view/index.js +2 -1
- package/dist/json-view/index.wxml +2 -1
- package/dist/less/api-view.less +14 -0
- package/dist/less/network-view.less +685 -0
- package/dist/network-view/index.js +300 -0
- package/dist/network-view/index.json +6 -0
- package/dist/network-view/index.less +1 -0
- package/dist/network-view/index.wxml +209 -0
- package/dist/network-view/index.wxss +582 -0
- package/dist/network-view/utils.js +240 -0
- package/dist/table-view/index.js +11 -18
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.50.0](https://github.com/dlhandsome/we-debug/compare/v0.49.2...v0.50.0) (2026-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **api:** 新增 wx API 抓包面板 ([da85c30](https://github.com/dlhandsome/we-debug/commit/da85c30bbdd5d40b314b74d64dd22f1137157304))
|
|
12
|
+
* **network:** 新增 Chrome 风格的 Network 抓包面板 ([5e69881](https://github.com/dlhandsome/we-debug/commit/5e69881c74e24f5605fd5ef996f7b66f139d43bb))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [0.49.2](https://github.com/dlhandsome/we-debug/compare/v0.49.1...v0.49.2) (2025-11-12)
|
|
19
|
+
|
|
20
|
+
**Note:** Version bump only for package @we-debug/miniprogram
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [0.49.1](https://github.com/dlhandsome/we-debug/compare/v0.49.0...v0.49.1) (2025-10-31)
|
|
7
27
|
|
|
8
28
|
**Note:** Version bump only for package @we-debug/miniprogram
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import Debug from '@we-debug/core';
|
|
2
|
+
import { formatTime, formatClock, stringify, truncate, toJsonPreview } from '../network-view/utils';
|
|
3
|
+
import { TYPE_FILTERS, DETAIL_TABS, toSummary, matchFilter, toCallCode } from './utils';
|
|
4
|
+
|
|
5
|
+
const store = Debug.store;
|
|
6
|
+
const { isFunc } = Debug.util;
|
|
7
|
+
|
|
8
|
+
const prefix = 'debug:apiview-';
|
|
9
|
+
const RENDER_THROTTLE = 200;
|
|
10
|
+
|
|
11
|
+
const getDetailKey = record => `${record.id}:${record.status}:${record.endTime}`;
|
|
12
|
+
|
|
13
|
+
const STATUS_LABEL = {
|
|
14
|
+
pending: '(pending)',
|
|
15
|
+
success: 'success',
|
|
16
|
+
fail: 'fail',
|
|
17
|
+
done: 'called(未传回调,无法获取结果)'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
Component({
|
|
21
|
+
properties: {
|
|
22
|
+
config: {
|
|
23
|
+
type: Object,
|
|
24
|
+
value: {}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
data: {
|
|
29
|
+
typeFilters: TYPE_FILTERS,
|
|
30
|
+
detailTabs: DETAIL_TABS,
|
|
31
|
+
activeType: 'all',
|
|
32
|
+
keyword: '',
|
|
33
|
+
recording: true,
|
|
34
|
+
preserveLog: false,
|
|
35
|
+
list: [],
|
|
36
|
+
summary: {
|
|
37
|
+
count: 0,
|
|
38
|
+
total: 0,
|
|
39
|
+
failed: 0,
|
|
40
|
+
finish: '0 ms'
|
|
41
|
+
},
|
|
42
|
+
selectedId: 0,
|
|
43
|
+
activeTab: 'Overview',
|
|
44
|
+
detail: null
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
observers: {
|
|
48
|
+
'config.id'(id) {
|
|
49
|
+
this.bindView(id);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
methods: {
|
|
54
|
+
getView() {
|
|
55
|
+
return store.apiviews.getById(this.properties.config.id);
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
callHandler(name, ...args) {
|
|
59
|
+
const view = this.getView();
|
|
60
|
+
const fn = view && view.handler && view.handler[name];
|
|
61
|
+
return isFunc(fn) ? fn(...args) : undefined;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
getRecords() {
|
|
65
|
+
return this.callHandler('getRecords') || [];
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
getSelectedRecord() {
|
|
69
|
+
return this.getRecords().find(r => r.id === this.data.selectedId);
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
bindView(id) {
|
|
73
|
+
this.unbindView();
|
|
74
|
+
if (!id) return;
|
|
75
|
+
this._eventKey = prefix + id + ':emit';
|
|
76
|
+
this._onEmit = () => this.scheduleRender();
|
|
77
|
+
store.event.on(this._eventKey, this._onEmit);
|
|
78
|
+
this.render();
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
unbindView() {
|
|
82
|
+
if (this._eventKey && this._onEmit) {
|
|
83
|
+
store.event.off(this._eventKey, this._onEmit);
|
|
84
|
+
}
|
|
85
|
+
this._eventKey = null;
|
|
86
|
+
this._onEmit = null;
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
scheduleRender() {
|
|
90
|
+
if (!this._visible) {
|
|
91
|
+
this._dirty = true;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (this._renderTimer) return;
|
|
95
|
+
this._renderTimer = setTimeout(() => {
|
|
96
|
+
this._renderTimer = null;
|
|
97
|
+
this.render();
|
|
98
|
+
}, RENDER_THROTTLE);
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
render() {
|
|
102
|
+
this._dirty = false;
|
|
103
|
+
const records = this.getRecords();
|
|
104
|
+
const state = this.callHandler('getState') || {};
|
|
105
|
+
const { activeType, keyword, selectedId } = this.data;
|
|
106
|
+
const filtered = records.filter(r => matchFilter(r, activeType, keyword));
|
|
107
|
+
|
|
108
|
+
let failed = 0;
|
|
109
|
+
let firstStart = 0;
|
|
110
|
+
let lastEnd = 0;
|
|
111
|
+
filtered.forEach(r => {
|
|
112
|
+
if (r.status === 'fail') failed++;
|
|
113
|
+
if (!firstStart || r.startTime < firstStart) firstStart = r.startTime;
|
|
114
|
+
if (r.endTime > lastEnd) lastEnd = r.endTime;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const nextData = {
|
|
118
|
+
recording: state.recording !== false,
|
|
119
|
+
preserveLog: !!state.preserveLog,
|
|
120
|
+
list: filtered.map(toSummary),
|
|
121
|
+
summary: {
|
|
122
|
+
count: filtered.length,
|
|
123
|
+
total: records.length,
|
|
124
|
+
failed,
|
|
125
|
+
finish: lastEnd && firstStart ? formatTime(lastEnd - firstStart) : '0 ms'
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
if (selectedId) {
|
|
130
|
+
const record = records.find(r => r.id === selectedId);
|
|
131
|
+
if (!record) {
|
|
132
|
+
nextData.selectedId = 0;
|
|
133
|
+
nextData.detail = null;
|
|
134
|
+
} else if (getDetailKey(record) !== this._detailKey) {
|
|
135
|
+
// 详情未变化时不重新 setData,避免 json-view 被重置而丢失展开状态
|
|
136
|
+
this._detailKey = getDetailKey(record);
|
|
137
|
+
nextData.detail = this.toDetail(record);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
this.setData(nextData);
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
toDetail(record) {
|
|
145
|
+
const paramsText = truncate(stringify(record.params));
|
|
146
|
+
const resultText = truncate(stringify(record.result));
|
|
147
|
+
const isPending = record.status === 'pending';
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
id: record.id,
|
|
151
|
+
name: 'wx.' + record.name,
|
|
152
|
+
isError: record.status === 'fail',
|
|
153
|
+
isPending,
|
|
154
|
+
general: [
|
|
155
|
+
{ key: 'API', value: 'wx.' + record.name },
|
|
156
|
+
{ key: 'Status', value: STATUS_LABEL[record.status] || record.status },
|
|
157
|
+
{ key: 'Type', value: record.type },
|
|
158
|
+
{ key: 'Page', value: record.route || '-' },
|
|
159
|
+
...(record.errMsg ? [{ key: 'errMsg', value: record.errMsg }] : [])
|
|
160
|
+
],
|
|
161
|
+
timing: [
|
|
162
|
+
{ key: 'Started at', value: formatClock(record.startTime) },
|
|
163
|
+
{ key: 'Finished at', value: formatClock(record.endTime) },
|
|
164
|
+
{ key: 'Duration', value: isPending ? 'Pending' : formatTime(record.duration) }
|
|
165
|
+
],
|
|
166
|
+
initiator: record.initiator || [],
|
|
167
|
+
paramsJson: toJsonPreview(record.params),
|
|
168
|
+
paramsText: paramsText.text,
|
|
169
|
+
paramsTruncated: paramsText.truncated,
|
|
170
|
+
resultJson: toJsonPreview(record.result),
|
|
171
|
+
resultText: resultText.text,
|
|
172
|
+
resultTruncated: resultText.truncated,
|
|
173
|
+
isDone: record.status === 'done'
|
|
174
|
+
};
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
handleToggleRecord() {
|
|
178
|
+
this.callHandler('bindRecordChange', !this.data.recording);
|
|
179
|
+
this.render();
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
handleClear() {
|
|
183
|
+
this.callHandler('bindClear');
|
|
184
|
+
this.setData({ selectedId: 0, detail: null });
|
|
185
|
+
this.render();
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
handleTogglePreserveLog() {
|
|
189
|
+
this.callHandler('bindPreserveLogChange', !this.data.preserveLog);
|
|
190
|
+
this.render();
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
handleSearch(e) {
|
|
194
|
+
this.setData({ keyword: e.detail.value });
|
|
195
|
+
this.render();
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
handleTypeTap(e) {
|
|
199
|
+
this.setData({ activeType: e.currentTarget.dataset.type });
|
|
200
|
+
this.render();
|
|
201
|
+
},
|
|
202
|
+
|
|
203
|
+
handleRowTap(e) {
|
|
204
|
+
const id = e.currentTarget.dataset.id;
|
|
205
|
+
const record = this.getRecords().find(r => r.id === id);
|
|
206
|
+
if (!record) return;
|
|
207
|
+
this._detailKey = getDetailKey(record);
|
|
208
|
+
this.setData({
|
|
209
|
+
selectedId: id,
|
|
210
|
+
detail: this.toDetail(record)
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
handleCloseDetail() {
|
|
215
|
+
this.setData({ selectedId: 0, detail: null });
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
handleTabTap(e) {
|
|
219
|
+
this.setData({ activeTab: e.currentTarget.dataset.tab });
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
copy(data) {
|
|
223
|
+
Debug.silent(() =>
|
|
224
|
+
wx.setClipboardData({
|
|
225
|
+
data,
|
|
226
|
+
success: () => Debug.silent(() => wx.showToast({ title: '已复制', icon: 'none' }))
|
|
227
|
+
})
|
|
228
|
+
);
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
handleCopyCall() {
|
|
232
|
+
const record = this.getSelectedRecord();
|
|
233
|
+
record && this.copy(toCallCode(record));
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
handleCopyParams() {
|
|
237
|
+
const record = this.getSelectedRecord();
|
|
238
|
+
record && this.copy(stringify(record.params));
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
handleCopyResult() {
|
|
242
|
+
const record = this.getSelectedRecord();
|
|
243
|
+
record && this.copy(stringify(record.result));
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
onMaskShow() {
|
|
247
|
+
this._visible = true;
|
|
248
|
+
if (this._dirty) this.render();
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
onMaskHide() {
|
|
252
|
+
this._visible = false;
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
lifetimes: {
|
|
257
|
+
attached() {
|
|
258
|
+
this._visible = true;
|
|
259
|
+
this._onMaskShow = this.onMaskShow.bind(this);
|
|
260
|
+
this._onMaskHide = this.onMaskHide.bind(this);
|
|
261
|
+
store.event.on('debug:mask:show-modal', this._onMaskShow);
|
|
262
|
+
store.event.on('debug:mask:hide-modal', this._onMaskHide);
|
|
263
|
+
if (!this._eventKey && this.properties.config.id) {
|
|
264
|
+
this.bindView(this.properties.config.id);
|
|
265
|
+
} else if (this._dirty) {
|
|
266
|
+
this.render();
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
detached() {
|
|
270
|
+
this.unbindView();
|
|
271
|
+
store.event.off('debug:mask:show-modal', this._onMaskShow);
|
|
272
|
+
store.event.off('debug:mask:hide-modal', this._onMaskHide);
|
|
273
|
+
clearTimeout(this._renderTimer);
|
|
274
|
+
this._renderTimer = null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '../less/api-view.less';
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<view class="nv">
|
|
2
|
+
<!-- 操作栏 -->
|
|
3
|
+
<view class="nv-toolbar">
|
|
4
|
+
<view class="nv-btn" bindtap="handleToggleRecord">
|
|
5
|
+
<view class="nv-record {{recording ? 'on' : ''}}"></view>
|
|
6
|
+
</view>
|
|
7
|
+
<view class="nv-search">
|
|
8
|
+
<input class="nv-search-input" placeholder="过滤 API" value="{{keyword}}" bindinput="handleSearch" />
|
|
9
|
+
</view>
|
|
10
|
+
<view class="nv-btn" bindtap="handleClear">
|
|
11
|
+
<view class="nv-icon trash"></view>
|
|
12
|
+
</view>
|
|
13
|
+
<view class="nv-chip {{preserveLog ? 'active' : ''}}" bindtap="handleTogglePreserveLog">
|
|
14
|
+
<view class="nv-checkbox {{preserveLog ? 'checked' : ''}}"></view>
|
|
15
|
+
<text>Preserve log</text>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
|
|
19
|
+
<!-- 类型筛选 -->
|
|
20
|
+
<scroll-view class="nv-types" scroll-x="{{true}}">
|
|
21
|
+
<view
|
|
22
|
+
wx:for="{{typeFilters}}"
|
|
23
|
+
wx:key="key"
|
|
24
|
+
class="nv-type {{activeType === item.key ? 'active' : ''}}"
|
|
25
|
+
data-type="{{item.key}}"
|
|
26
|
+
bindtap="handleTypeTap"
|
|
27
|
+
>{{item.label}}</view>
|
|
28
|
+
</scroll-view>
|
|
29
|
+
|
|
30
|
+
<!-- 调用列表 -->
|
|
31
|
+
<view class="nv-table">
|
|
32
|
+
<view class="nv-row nv-head">
|
|
33
|
+
<view class="nv-col name">Name</view>
|
|
34
|
+
<view class="nv-col status">Status</view>
|
|
35
|
+
<view class="nv-col method">Type</view>
|
|
36
|
+
<view class="nv-col time">Time</view>
|
|
37
|
+
</view>
|
|
38
|
+
<scroll-view class="nv-body" scroll-y="{{true}}">
|
|
39
|
+
<view
|
|
40
|
+
wx:for="{{list}}"
|
|
41
|
+
wx:key="id"
|
|
42
|
+
class="nv-row {{item.isError ? 'error' : ''}} {{item.isPending ? 'pending' : ''}} {{selectedId === item.id ? 'selected' : ''}}"
|
|
43
|
+
data-id="{{item.id}}"
|
|
44
|
+
bindtap="handleRowTap"
|
|
45
|
+
>
|
|
46
|
+
<view class="nv-col name">
|
|
47
|
+
<view class="nv-name">{{item.name}}</view>
|
|
48
|
+
<view wx:if="{{item.dir}}" class="nv-dir">{{item.dir}}</view>
|
|
49
|
+
</view>
|
|
50
|
+
<view class="nv-col status">{{item.statusText}}</view>
|
|
51
|
+
<view class="nv-col method">{{item.type}}</view>
|
|
52
|
+
<view class="nv-col time">{{item.time}}</view>
|
|
53
|
+
</view>
|
|
54
|
+
<view wx:if="{{list.length === 0}}" class="nv-empty">
|
|
55
|
+
<block wx:if="{{recording}}">
|
|
56
|
+
<view>Recording wx API calls...</view>
|
|
57
|
+
<view class="nv-empty-sub">调用 wx API 后将在此展示</view>
|
|
58
|
+
</block>
|
|
59
|
+
<block wx:else>
|
|
60
|
+
<view>Recording paused</view>
|
|
61
|
+
<view class="nv-empty-sub">点击左上角录制按钮恢复抓包</view>
|
|
62
|
+
</block>
|
|
63
|
+
</view>
|
|
64
|
+
</scroll-view>
|
|
65
|
+
</view>
|
|
66
|
+
|
|
67
|
+
<!-- 状态栏 -->
|
|
68
|
+
<view class="nv-statusbar">
|
|
69
|
+
<view class="nv-stat"><text class="nv-stat-label">Calls:</text><text class="nv-stat-value">{{summary.count}} / {{summary.total}}</text></view>
|
|
70
|
+
<view class="nv-stat"><text class="nv-stat-label">Failed:</text><text class="nv-stat-value">{{summary.failed}}</text></view>
|
|
71
|
+
<view class="nv-stat"><text class="nv-stat-label">Finish:</text><text class="nv-stat-value">{{summary.finish}}</text></view>
|
|
72
|
+
</view>
|
|
73
|
+
|
|
74
|
+
<!-- 详情抽屉 -->
|
|
75
|
+
<view class="nv-drawer {{detail ? 'show' : ''}}">
|
|
76
|
+
<block wx:if="{{detail}}">
|
|
77
|
+
<view class="nv-drawer-header">
|
|
78
|
+
<view class="nv-drawer-title {{detail.isError ? 'error' : ''}}">{{detail.name}}</view>
|
|
79
|
+
<view class="nv-drawer-close" bindtap="handleCloseDetail"></view>
|
|
80
|
+
</view>
|
|
81
|
+
<view class="nv-tabs">
|
|
82
|
+
<view
|
|
83
|
+
wx:for="{{detailTabs}}"
|
|
84
|
+
wx:key="*this"
|
|
85
|
+
class="nv-tab {{activeTab === item ? 'active' : ''}}"
|
|
86
|
+
data-tab="{{item}}"
|
|
87
|
+
bindtap="handleTabTap"
|
|
88
|
+
>{{item}}</view>
|
|
89
|
+
</view>
|
|
90
|
+
|
|
91
|
+
<!-- Overview -->
|
|
92
|
+
<scroll-view wx:if="{{activeTab === 'Overview'}}" class="nv-drawer-body" scroll-y="{{true}}">
|
|
93
|
+
<view class="nv-card">
|
|
94
|
+
<view class="nv-card-title">General</view>
|
|
95
|
+
<view class="nv-kv" wx:for="{{detail.general}}" wx:key="key">
|
|
96
|
+
<text class="nv-k">{{item.key}}</text>
|
|
97
|
+
<text class="nv-v {{(item.key === 'Status' || item.key === 'errMsg') && detail.isError ? 'error' : ''}}" user-select>{{item.value}}</text>
|
|
98
|
+
</view>
|
|
99
|
+
</view>
|
|
100
|
+
<view class="nv-card">
|
|
101
|
+
<view class="nv-card-title">Timing</view>
|
|
102
|
+
<view class="nv-kv" wx:for="{{detail.timing}}" wx:key="key">
|
|
103
|
+
<text class="nv-k">{{item.key}}</text>
|
|
104
|
+
<text class="nv-v">{{item.value}}</text>
|
|
105
|
+
</view>
|
|
106
|
+
</view>
|
|
107
|
+
<view wx:if="{{detail.initiator.length > 0}}" class="nv-card">
|
|
108
|
+
<view class="nv-card-title">Initiator</view>
|
|
109
|
+
<text class="nv-code nv-initiator" user-select wx:for="{{detail.initiator}}" wx:key="index">{{item}}</text>
|
|
110
|
+
</view>
|
|
111
|
+
<view class="nv-actions">
|
|
112
|
+
<view class="nv-action" bindtap="handleCopyCall"><view class="nv-icon copy"></view>复制调用代码</view>
|
|
113
|
+
</view>
|
|
114
|
+
</scroll-view>
|
|
115
|
+
|
|
116
|
+
<!-- Params -->
|
|
117
|
+
<view wx:elif="{{activeTab === 'Params'}}" class="nv-drawer-body nv-flex">
|
|
118
|
+
<view wx:if="{{detail.paramsText}}" class="nv-card nv-card-fill">
|
|
119
|
+
<view class="nv-card-title">
|
|
120
|
+
<text>Params</text>
|
|
121
|
+
<view class="nv-copy-btn" bindtap="handleCopyParams"><view class="nv-icon copy"></view></view>
|
|
122
|
+
</view>
|
|
123
|
+
<view wx:if="{{detail.paramsJson}}" class="nv-json">
|
|
124
|
+
<w-json-view config="{{ { data: detail.paramsJson, expandLevel: 2 } }}" />
|
|
125
|
+
</view>
|
|
126
|
+
<scroll-view wx:else class="nv-json" scroll-y="{{true}}">
|
|
127
|
+
<text class="nv-code" user-select>{{detail.paramsText}}</text>
|
|
128
|
+
</scroll-view>
|
|
129
|
+
</view>
|
|
130
|
+
<view wx:else class="nv-placeholder">This call has no params</view>
|
|
131
|
+
</view>
|
|
132
|
+
|
|
133
|
+
<!-- Result -->
|
|
134
|
+
<view wx:elif="{{activeTab === 'Result'}}" class="nv-drawer-body nv-flex">
|
|
135
|
+
<view wx:if="{{detail.isPending}}" class="nv-placeholder">Pending...</view>
|
|
136
|
+
<view wx:elif="{{detail.isDone}}" class="nv-placeholder">未传入回调且未返回 Promise,无法获取调用结果</view>
|
|
137
|
+
<view wx:elif="{{detail.resultText}}" class="nv-card nv-card-fill">
|
|
138
|
+
<view class="nv-card-title">
|
|
139
|
+
<text class="{{detail.isError ? 'nv-error-text' : ''}}">{{detail.isError ? 'Error' : 'Result'}}</text>
|
|
140
|
+
<view class="nv-copy-btn" bindtap="handleCopyResult"><view class="nv-icon copy"></view></view>
|
|
141
|
+
</view>
|
|
142
|
+
<view wx:if="{{detail.resultJson}}" class="nv-json">
|
|
143
|
+
<w-json-view config="{{ { data: detail.resultJson, expandLevel: 1 } }}" />
|
|
144
|
+
</view>
|
|
145
|
+
<scroll-view wx:else class="nv-json" scroll-y="{{true}}">
|
|
146
|
+
<text class="nv-code" user-select>{{detail.resultText}}</text>
|
|
147
|
+
</scroll-view>
|
|
148
|
+
<view wx:if="{{detail.resultTruncated}}" class="nv-none">内容过长已截断,可点击右上角复制完整内容</view>
|
|
149
|
+
</view>
|
|
150
|
+
<view wx:else class="nv-placeholder">This call has no result</view>
|
|
151
|
+
</view>
|
|
152
|
+
</block>
|
|
153
|
+
</view>
|
|
154
|
+
</view>
|