-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathplugin.js
More file actions
73 lines (63 loc) · 1.5 KB
/
Copy pathplugin.js
File metadata and controls
73 lines (63 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { MoveAreaHelper } from './utils';
export { MoveAreaHelper };
const uiCheckPlugin = {};
export const prefix = 'debug:ui-check:';
export let Debug;
export let closeBadge;
uiCheckPlugin.install = function (weDebug, options = {}) {
if (uiCheckPlugin.installed) return;
Debug = weDebug;
const event = weDebug.store.event;
const rule = weDebug.createFormRule(
Object.assign(
{},
{
title: 'UI对比',
desc: '点击按钮上传视觉稿',
type: 'button',
state: {
name: '上传'
},
handler: {
bindTap(state) {
if (!state.disabled) {
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
const tempFilePaths = res.tempFilePaths;
event.emit(prefix + 'init', tempFilePaths[0]);
}
});
}
}
}
},
options.rule
)
);
closeBadge = weDebug.createBadge(
Object.assign(
{},
{
key: 'close',
show: false,
draggable: true,
position: {
right: 10,
top: 10
},
handler: {
bindTap() {
event.emit(prefix + 'destory');
}
}
},
options.closeBadge
)
);
weDebug.addBadge([closeBadge]);
weDebug.addFormRule([rule]);
};
export default uiCheckPlugin;