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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import _mergeJSXProps from 'babel-helper-vue-jsx-merge-props';
import _extends from 'babel-runtime/helpers/extends';
import Upload from '../index';
export default {
data: function data() {
return {
destroyed: false
};
},
methods: {
destroy: function destroy() {
this.destroyed = true;
}
},
render: function render() {
var h = arguments[0];
if (this.destroyed) {
return null;
}
var propsObj = {
action: '//jsonplaceholder.typicode.com/posts/',
data: { a: 1, b: 2 },
headers: {
Authorization: 'xxxxxxx'
},
multiple: true,
beforeUpload: function beforeUpload(file) {
console.log('beforeUpload', file.name);
}
};
var propsEvent = {
start: function start(file) {
console.log('start', file, file.name);
},
success: function success(file) {
console.log('success', file);
},
progress: function progress(step, file) {
console.log('progress', Math.round(step.percent), file.name);
},
error: function error(err) {
console.log('error', err);
}
};
var uploaderProps = {
props: _extends({}, propsObj),
on: _extends({}, propsEvent),
ref: 'inner'
};
var uploaderProps1 = {
props: _extends({}, propsObj, {
componentTag: 'div'
}),
on: _extends({}, propsEvent)
};
var style = '\n .rc-upload-disabled {\n opacity:0.5;\n ';
return h(
'div',
{
style: {
margin: '100px'
}
},
[h('h2', ['\u56FA\u5B9A\u4F4D\u7F6E']), h('style', [style]), h('div', [h(
Upload,
uploaderProps,
[h('a', ['\u5F00\u59CB\u4E0A\u4F20'])]
)]), h('h2', ['\u6EDA\u52A8']), h(
'div',
{
style: {
height: '200px',
overflow: 'auto',
border: '1px solid red'
}
},
[h(
'div',
{
style: {
height: '500px'
}
},
[h(
Upload,
_mergeJSXProps([uploaderProps1, {
attrs: { component: 'div' },
style: { display: 'inline-block' } }]),
[h('a', ['\u5F00\u59CB\u4E0A\u4F202'])]
)]
)]
), h(
'button',
{
on: {
'click': this.destroy
}
},
['destroy']
)]
);
}
};