1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define([], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["uploader"] = factory();
|
8 | else
|
9 | root["uploader"] = factory();
|
10 | })(this, function() {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.i = function(value) { return value; };
|
48 |
|
49 |
|
50 | __webpack_require__.d = function(exports, name, getter) {
|
51 | if(!__webpack_require__.o(exports, name)) {
|
52 | Object.defineProperty(exports, name, {
|
53 | configurable: false,
|
54 | enumerable: true,
|
55 | get: getter
|
56 | /******/ });
|
57 | /******/ }
|
58 | /******/ };
|
59 | /******/
|
60 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
61 | /******/ __webpack_require__.n = function(module) {
|
62 | var getter = module && module.__esModule ?
|
63 | function getDefault() { return module['default']; } :
|
64 | function getModuleExports() { return module; };
|
65 | __webpack_require__.d(getter, 'a', getter);
|
66 | return getter;
|
67 | };
|
68 |
|
69 |
|
70 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
71 |
|
72 |
|
73 | __webpack_require__.p = "";
|
74 |
|
75 |
|
76 | return __webpack_require__(__webpack_require__.s = 11);
|
77 | })
|
78 |
|
79 | ([
|
80 |
|
81 | (function(module, exports, __webpack_require__) {
|
82 |
|
83 | function injectStyle (ssrContext) {
|
84 | __webpack_require__(8)
|
85 | }
|
86 | var Component = __webpack_require__(6)(
|
87 |
|
88 | __webpack_require__(2),
|
89 |
|
90 | __webpack_require__(7),
|
91 |
|
92 | injectStyle,
|
93 |
|
94 | null,
|
95 |
|
96 | null
|
97 | )
|
98 |
|
99 | module.exports = Component.exports
|
100 |
|
101 |
|
102 | }),
|
103 |
|
104 | (function(module, exports, __webpack_require__) {
|
105 |
|
106 | "use strict";
|
107 |
|
108 |
|
109 | Object.defineProperty(exports, "__esModule", {
|
110 | value: true
|
111 | });
|
112 |
|
113 | var _wx = __webpack_require__(3);
|
114 |
|
115 | var _uploader = __webpack_require__(0);
|
116 |
|
117 | var _uploader2 = _interopRequireDefault(_uploader);
|
118 |
|
119 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 | function uploadWechatImage(localId) {
|
127 | var serverId = null;
|
128 | return (0, _wx.uploadImage)(localId).then(function (_serverId) {
|
129 | serverId = _serverId;
|
130 | return localId;
|
131 | }).then(_wx.getLocalImgData)
|
132 | .then(function (imageData) {
|
133 | return {
|
134 | image: imageData,
|
135 | serverId: serverId
|
136 | };
|
137 | });
|
138 | }
|
139 |
|
140 |
|
141 |
|
142 |
|
143 | exports.default = {
|
144 | name: 'WechatUploader',
|
145 | extends: _uploader2.default,
|
146 | props: {
|
147 | |
148 |
|
149 |
|
150 | useWechatPreview: {
|
151 | type: Boolean,
|
152 | default: true
|
153 | }
|
154 | },
|
155 | data: function data() {
|
156 | return {
|
157 | |
158 |
|
159 |
|
160 | serverIds: []
|
161 | };
|
162 | },
|
163 |
|
164 | methods: {
|
165 | |
166 |
|
167 |
|
168 | setImages: function setImages(data) {
|
169 | var images = [];
|
170 | var serverIds = [];
|
171 | for (var i = 0, len = data.length; i < len; i++) {
|
172 | images.push(data[i].image);
|
173 | serverIds.push(data[i].serverId);
|
174 | }
|
175 | this.images = images;
|
176 | this.serverIds = serverIds;
|
177 | },
|
178 |
|
179 | |
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | add: function add(image, serverId) {
|
186 | if (this.images.length < this.size) {
|
187 | this.images.push(image);
|
188 | this.serverIds.push(serverId);
|
189 | this.$emit('add', {
|
190 | image: image,
|
191 | serverId: serverId
|
192 | });
|
193 | return true;
|
194 | }
|
195 | return false;
|
196 | },
|
197 |
|
198 | |
199 |
|
200 |
|
201 |
|
202 |
|
203 | getImages: function getImages() {
|
204 | var result = [];
|
205 | for (var i = 0, len = this.images.length; i < len; i++) {
|
206 | result.push({
|
207 | image: this.images[i],
|
208 | serverId: this.serverIds[i]
|
209 | });
|
210 | }
|
211 | return result;
|
212 | },
|
213 |
|
214 | |
215 |
|
216 |
|
217 |
|
218 |
|
219 | remove: function remove(index) {
|
220 | if (0 <= index && index < this.size) {
|
221 | this.images.splice(index, 1);
|
222 | this.serverIds.splice(index, 1);
|
223 | this.$emit('remove', index);
|
224 | return true;
|
225 | }
|
226 | return false;
|
227 | },
|
228 |
|
229 | |
230 |
|
231 |
|
232 | onClickRequest: function onClickRequest() {
|
233 | this.request();
|
234 | },
|
235 |
|
236 | |
237 |
|
238 |
|
239 | request: function request() {
|
240 | var vm = this;
|
241 | return (0, _wx.chooseImage)(vm.size - vm.images.length).then(function (localIds) {
|
242 | if (localIds.length > 0) {
|
243 | vm.$emit('load');
|
244 | return vm.uploadWechatImages(localIds).then(function () {
|
245 | vm.$emit('finish');
|
246 | });
|
247 | }
|
248 | });
|
249 | },
|
250 |
|
251 | |
252 |
|
253 |
|
254 | uploadWechatImages: function uploadWechatImages(localIds) {
|
255 | var vm = this;
|
256 | var localId = localIds.shift();
|
257 | return uploadWechatImage(localId).then(function (_ref) {
|
258 | var image = _ref.image,
|
259 | serverId = _ref.serverId;
|
260 |
|
261 | vm.add(image, serverId);
|
262 | if (localIds.length > 0) {
|
263 | return vm.uploadWechatImages(localIds);
|
264 | }
|
265 | });
|
266 | }
|
267 | },
|
268 | mounted: function mounted() {
|
269 | this.$on('click', function (index) {
|
270 | (0, _wx.previewImage)(this.images[index], this.images);
|
271 | });
|
272 | }
|
273 | };
|
274 |
|
275 | }),
|
276 |
|
277 | (function(module, exports, __webpack_require__) {
|
278 |
|
279 | "use strict";
|
280 |
|
281 |
|
282 | Object.defineProperty(exports, "__esModule", {
|
283 | value: true
|
284 | });
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | exports.default = {
|
325 | name: 'ROUploader',
|
326 | props: {
|
327 | |
328 |
|
329 |
|
330 | size: {
|
331 | type: Number,
|
332 | default: 1
|
333 | },
|
334 | |
335 |
|
336 |
|
337 | canModify: {
|
338 | type: Boolean,
|
339 | default: true
|
340 | },
|
341 | |
342 |
|
343 |
|
344 | containerClass: {
|
345 | type: [Object, Array],
|
346 | default: function _default() {
|
347 | return {};
|
348 | }
|
349 | },
|
350 | |
351 |
|
352 |
|
353 | containerStyle: {
|
354 | type: Object,
|
355 | default: function _default() {
|
356 | return {};
|
357 | }
|
358 | },
|
359 | |
360 |
|
361 |
|
362 | imageClass: {
|
363 | type: [Object, Array],
|
364 | default: function _default() {
|
365 | return {};
|
366 | }
|
367 | },
|
368 | |
369 |
|
370 |
|
371 | imageStyle: {
|
372 | type: Object,
|
373 | default: function _default() {
|
374 | return {};
|
375 | }
|
376 | },
|
377 | |
378 |
|
379 |
|
380 | imageWrapClass: {
|
381 | type: [Object, Array],
|
382 | default: function _default() {
|
383 | return {};
|
384 | }
|
385 | },
|
386 | |
387 |
|
388 |
|
389 | imageWrapStyle: {
|
390 | type: Object,
|
391 | default: function _default() {
|
392 | return {};
|
393 | }
|
394 | },
|
395 | |
396 |
|
397 |
|
398 | requestClass: {
|
399 | type: [Object, Array],
|
400 | default: function _default() {
|
401 | return {};
|
402 | }
|
403 | },
|
404 | |
405 |
|
406 |
|
407 | requestStyle: {
|
408 | type: Object,
|
409 | default: function _default() {
|
410 | return {};
|
411 | }
|
412 | },
|
413 | |
414 |
|
415 |
|
416 | removeClass: {
|
417 | type: [Object, Array],
|
418 | default: function _default() {
|
419 | return {};
|
420 | }
|
421 | },
|
422 | |
423 |
|
424 |
|
425 | removeStyle: {
|
426 | type: Object,
|
427 | default: function _default() {
|
428 | return {};
|
429 | }
|
430 | },
|
431 | |
432 |
|
433 |
|
434 | lazyload: {
|
435 | type: Boolean,
|
436 | default: false
|
437 | }
|
438 | },
|
439 | data: function data() {
|
440 | return {
|
441 |
|
442 | images: []
|
443 | };
|
444 | },
|
445 |
|
446 | methods: {
|
447 | |
448 |
|
449 |
|
450 | setImages: function setImages(images) {
|
451 | var tmp = [];
|
452 | for (var i = 0, len = images.length; i < len; i++) {
|
453 | tmp.push(images[i]);
|
454 | }
|
455 | this.images = tmp;
|
456 | },
|
457 |
|
458 | |
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 | add: function add(image) {
|
467 | if (this.images.length < this.size) {
|
468 | this.images.push(image);
|
469 | this.$emit('add', image);
|
470 | return true;
|
471 | }
|
472 | return false;
|
473 | },
|
474 |
|
475 | |
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 | remove: function remove(index) {
|
484 | if (0 <= index && index < this.size) {
|
485 | this.images.splice(index, 1);
|
486 | this.$emit('remove', index);
|
487 | return true;
|
488 | }
|
489 | return false;
|
490 | },
|
491 |
|
492 | |
493 |
|
494 |
|
495 | removeAll: function removeAll() {
|
496 | for (var i = 0, len = this.images.length; i < len; i++) {
|
497 | this.remove(i);
|
498 | }
|
499 | return true;
|
500 | },
|
501 |
|
502 | |
503 |
|
504 |
|
505 |
|
506 |
|
507 | getImages: function getImages() {
|
508 | return this.images.slice(0);
|
509 | },
|
510 |
|
511 | |
512 |
|
513 |
|
514 |
|
515 |
|
516 | onClickImage: function onClickImage(index) {
|
517 | this.$emit('click', index);
|
518 | },
|
519 |
|
520 | |
521 |
|
522 |
|
523 | onClickRemove: function onClickRemove(index) {
|
524 | this.remove(index);
|
525 | },
|
526 |
|
527 | |
528 |
|
529 |
|
530 | onClickRequest: function onClickRequest() {
|
531 | this.$emit('request');
|
532 | },
|
533 |
|
534 | |
535 |
|
536 |
|
537 | onPress: function onPress(index) {
|
538 | var _this = this;
|
539 |
|
540 | return function () {
|
541 | _this.$emit('menu', index);
|
542 | };
|
543 | },
|
544 |
|
545 | |
546 |
|
547 |
|
548 | getSize: function getSize() {
|
549 | return this.size;
|
550 | },
|
551 |
|
552 | |
553 |
|
554 |
|
555 | getCount: function getCount() {
|
556 | return this.images.length;
|
557 | }
|
558 | }
|
559 | };
|
560 |
|
561 | }),
|
562 |
|
563 | (function(module, exports, __webpack_require__) {
|
564 |
|
565 | "use strict";
|
566 |
|
567 |
|
568 | Object.defineProperty(exports, "__esModule", {
|
569 | value: true
|
570 | });
|
571 | exports.previewImage = previewImage;
|
572 | exports.chooseImage = chooseImage;
|
573 | exports.uploadImage = uploadImage;
|
574 | exports.getLocalImgData = getLocalImgData;
|
575 | var isIOS = /iPhone/.test(navigator.userAgent);
|
576 |
|
577 | function previewImage(image, images) {
|
578 | wx.previewImage({
|
579 | current: image,
|
580 | urls: images
|
581 | });
|
582 | }
|
583 |
|
584 |
|
585 |
|
586 |
|
587 | function chooseImage(count) {
|
588 | return new Promise(function (resolve, reject) {
|
589 | wx.chooseImage({
|
590 | count: count,
|
591 | sizeType: ['compressed'],
|
592 | success: function success(res) {
|
593 | console.log('chooseImage', res);
|
594 | return resolve(res.localIds);
|
595 | }
|
596 | });
|
597 | });
|
598 | }
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 | function uploadImage(localId) {
|
607 | return new Promise(function (resolve, reject) {
|
608 | wx.uploadImage({
|
609 | localId: localId,
|
610 | isShowProgressTips: 0,
|
611 | success: function success(res) {
|
612 | return resolve(res.serverId);
|
613 | }
|
614 | });
|
615 | });
|
616 | }
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 | function getLocalImgData(localId) {
|
624 | if (!isIOS || !window.__wxjs_is_wkwebview) {
|
625 | return localId;
|
626 | }
|
627 | return new Promise(function (resolve, reject) {
|
628 | wx.getLocalImgData({
|
629 | localId: localId,
|
630 | success: function success(res) {
|
631 | return resolve(res.localData);
|
632 | }
|
633 | });
|
634 | });
|
635 | }
|
636 |
|
637 | }),
|
638 |
|
639 | (function(module, exports, __webpack_require__) {
|
640 |
|
641 | exports = module.exports = __webpack_require__(5)(undefined);
|
642 |
|
643 |
|
644 |
|
645 |
|
646 | exports.push([module.i, ".ro-uploader-wrap{display:flex;background-color:#fff;text-decoration:none}.ro-uploader-wrap .ro-uploader-image-wrap{position:relative;margin-right:5px}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-image{vertical-align:middle;width:70px;height:70px;background-repeat:no-repeat;background-size:cover;background-position:50%;background-color:#aaa}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove{position:absolute;width:18px;height:18px;font-size:18px;line-height:18px;color:#fff;background-color:#aaa;top:0;right:0}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:after,.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:before{background-color:#fff;transform:translate(-50%,-50%) rotate(45deg)}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:before{width:2px;height:18px}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:after{width:18px;height:2px}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:active{border-color:#fff}.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:active:after,.ro-uploader-wrap .ro-uploader-image-wrap .ro-uploader-remove:active:before{background-color:#fff}.ro-uploader-wrap .ro-uploader-request{position:relative;width:70px;height:70px;border:1px solid #aaa;box-sizing:border-box}.ro-uploader-wrap .ro-uploader-request:after,.ro-uploader-wrap .ro-uploader-request:before{background-color:#bbb}.ro-uploader-wrap .ro-uploader-request:before{width:2px;height:35px}.ro-uploader-wrap .ro-uploader-request:after{width:35px;height:2px}.ro-uploader-wrap .ro-uploader-request:active{border-color:#888}.ro-uploader-wrap .ro-uploader-request:active:after,.ro-uploader-wrap .ro-uploader-request:active:before{background-color:#888}.ro-uploader-wrap .ro-uploader-remove:after,.ro-uploader-wrap .ro-uploader-remove:before,.ro-uploader-wrap .ro-uploader-request:after,.ro-uploader-wrap .ro-uploader-request:before{content:\" \";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}", ""]);
|
647 |
|
648 |
|
649 |
|
650 |
|
651 | }),
|
652 |
|
653 | (function(module, exports) {
|
654 |
|
655 |
|
656 |
|
657 |
|
658 |
|
659 |
|
660 | module.exports = function(useSourceMap) {
|
661 | var list = [];
|
662 |
|
663 |
|
664 | list.toString = function toString() {
|
665 | return this.map(function (item) {
|
666 | var content = cssWithMappingToString(item, useSourceMap);
|
667 | if(item[2]) {
|
668 | return "@media " + item[2] + "{" + content + "}";
|
669 | } else {
|
670 | return content;
|
671 | }
|
672 | }).join("");
|
673 | };
|
674 |
|
675 |
|
676 | list.i = function(modules, mediaQuery) {
|
677 | if(typeof modules === "string")
|
678 | modules = [[null, modules, ""]];
|
679 | var alreadyImportedModules = {};
|
680 | for(var i = 0; i < this.length; i++) {
|
681 | var id = this[i][0];
|
682 | if(typeof id === "number")
|
683 | alreadyImportedModules[id] = true;
|
684 | }
|
685 | for(i = 0; i < modules.length; i++) {
|
686 | var item = modules[i];
|
687 |
|
688 |
|
689 |
|
690 |
|
691 | if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
|
692 | if(mediaQuery && !item[2]) {
|
693 | item[2] = mediaQuery;
|
694 | } else if(mediaQuery) {
|
695 | item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
|
696 | }
|
697 | list.push(item);
|
698 | }
|
699 | }
|
700 | };
|
701 | return list;
|
702 | };
|
703 |
|
704 | function cssWithMappingToString(item, useSourceMap) {
|
705 | var content = item[1] || '';
|
706 | var cssMapping = item[3];
|
707 | if (!cssMapping) {
|
708 | return content;
|
709 | }
|
710 |
|
711 | if (useSourceMap && typeof btoa === 'function') {
|
712 | var sourceMapping = toComment(cssMapping);
|
713 | var sourceURLs = cssMapping.sources.map(function (source) {
|
714 | return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
|
715 | });
|
716 |
|
717 | return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
|
718 | }
|
719 |
|
720 | return [content].join('\n');
|
721 | }
|
722 |
|
723 |
|
724 | function toComment(sourceMap) {
|
725 |
|
726 | var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
|
727 | var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
|
728 |
|
729 | return '/*# ' + data + ' */';
|
730 | }
|
731 |
|
732 |
|
733 | }),
|
734 |
|
735 | (function(module, exports) {
|
736 |
|
737 |
|
738 |
|
739 |
|
740 |
|
741 |
|
742 | module.exports = function normalizeComponent (
|
743 | rawScriptExports,
|
744 | compiledTemplate,
|
745 | injectStyles,
|
746 | scopeId,
|
747 | moduleIdentifier /* server only */
|
748 | ) {
|
749 | var esModule
|
750 | var scriptExports = rawScriptExports = rawScriptExports || {}
|
751 |
|
752 |
|
753 | var type = typeof rawScriptExports.default
|
754 | if (type === 'object' || type === 'function') {
|
755 | esModule = rawScriptExports
|
756 | scriptExports = rawScriptExports.default
|
757 | }
|
758 |
|
759 |
|
760 | var options = typeof scriptExports === 'function'
|
761 | ? scriptExports.options
|
762 | : scriptExports
|
763 |
|
764 |
|
765 | if (compiledTemplate) {
|
766 | options.render = compiledTemplate.render
|
767 | options.staticRenderFns = compiledTemplate.staticRenderFns
|
768 | }
|
769 |
|
770 |
|
771 | if (scopeId) {
|
772 | options._scopeId = scopeId
|
773 | }
|
774 |
|
775 | var hook
|
776 | if (moduleIdentifier) {
|
777 | hook = function (context) {
|
778 |
|
779 | context =
|
780 | context ||
|
781 | (this.$vnode && this.$vnode.ssrContext) ||
|
782 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
783 |
|
784 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
785 | context = __VUE_SSR_CONTEXT__
|
786 | }
|
787 |
|
788 | if (injectStyles) {
|
789 | injectStyles.call(this, context)
|
790 | }
|
791 |
|
792 | if (context && context._registeredComponents) {
|
793 | context._registeredComponents.add(moduleIdentifier)
|
794 | }
|
795 | }
|
796 |
|
797 |
|
798 | options._ssrRegister = hook
|
799 | } else if (injectStyles) {
|
800 | hook = injectStyles
|
801 | }
|
802 |
|
803 | if (hook) {
|
804 | var functional = options.functional
|
805 | var existing = functional
|
806 | ? options.render
|
807 | : options.beforeCreate
|
808 | if (!functional) {
|
809 |
|
810 | options.beforeCreate = existing
|
811 | ? [].concat(existing, hook)
|
812 | : [hook]
|
813 | } else {
|
814 |
|
815 | options.render = function renderWithStyleInjection (h, context) {
|
816 | hook.call(context)
|
817 | return existing(h, context)
|
818 | }
|
819 | }
|
820 | }
|
821 |
|
822 | return {
|
823 | esModule: esModule,
|
824 | exports: scriptExports,
|
825 | options: options
|
826 | }
|
827 | }
|
828 |
|
829 |
|
830 | }),
|
831 |
|
832 | (function(module, exports) {
|
833 |
|
834 | module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
|
835 | return _c('div', {
|
836 | staticClass: "ro-uploader-wrap",
|
837 | class: _vm.containerClass,
|
838 | style: (_vm.containerStyle)
|
839 | }, [_vm._l((_vm.images), function(image, index) {
|
840 | return _c('div', {
|
841 | staticClass: "ro-uploader-image-wrap",
|
842 | class: _vm.imageWrapClass,
|
843 | style: (_vm.imageWrapStyle)
|
844 | }, [(!_vm.lazyload) ? _c('div', {
|
845 | directives: [{
|
846 | name: "pressure-press",
|
847 | rawName: "v-pressure-press",
|
848 | value: (_vm.onPress(index)),
|
849 | expression: "onPress(index)"
|
850 | }],
|
851 | staticClass: "ro-uploader-image",
|
852 | class: _vm.imageClass,
|
853 | style: ([{
|
854 | 'background-image': 'url(' + image + ')'
|
855 | }, _vm.imageStyle]),
|
856 | on: {
|
857 | "click": function($event) {
|
858 | _vm.onClickImage(index)
|
859 | }
|
860 | }
|
861 | }) : _c('div', {
|
862 | directives: [{
|
863 | name: "lazy",
|
864 | rawName: "v-lazy:background-image",
|
865 | value: (image),
|
866 | expression: "image",
|
867 | arg: "background-image"
|
868 | }, {
|
869 | name: "pressure-press",
|
870 | rawName: "v-pressure-press",
|
871 | value: (_vm.onPress(index)),
|
872 | expression: "onPress(index)"
|
873 | }],
|
874 | staticClass: "ro-uploader-image",
|
875 | class: _vm.imageClass,
|
876 | style: ([_vm.imageStyle]),
|
877 | on: {
|
878 | "click": function($event) {
|
879 | _vm.onClickImage(index)
|
880 | }
|
881 | }
|
882 | }), _vm._v(" "), (_vm.canModify) ? _c('div', {
|
883 | staticClass: "ro-uploader-remove",
|
884 | class: _vm.removeClass,
|
885 | style: (_vm.removeStyle),
|
886 | on: {
|
887 | "click": function($event) {
|
888 | _vm.onClickRemove(index)
|
889 | }
|
890 | }
|
891 | }) : _vm._e()])
|
892 | }), _vm._v(" "), (_vm.images.length < _vm.size && _vm.canModify) ? _c('div', {
|
893 | staticClass: "ro-uploader-image-wrap ro-uploader-request",
|
894 | class: _vm.requestClass,
|
895 | style: (_vm.requestStyle),
|
896 | on: {
|
897 | "click": _vm.onClickRequest
|
898 | }
|
899 | }) : _vm._e()], 2)
|
900 | },staticRenderFns: []}
|
901 |
|
902 | }),
|
903 |
|
904 | (function(module, exports, __webpack_require__) {
|
905 |
|
906 |
|
907 |
|
908 |
|
909 | var content = __webpack_require__(4);
|
910 | if(typeof content === 'string') content = [[module.i, content, '']];
|
911 | if(content.locals) module.exports = content.locals;
|
912 |
|
913 | var update = __webpack_require__(9)("4fb8864b", content, true);
|
914 |
|
915 | }),
|
916 |
|
917 | (function(module, exports, __webpack_require__) {
|
918 |
|
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 | var hasDocument = typeof document !== 'undefined'
|
926 |
|
927 | if (typeof DEBUG !== 'undefined' && DEBUG) {
|
928 | if (!hasDocument) {
|
929 | throw new Error(
|
930 | 'vue-style-loader cannot be used in a non-browser environment. ' +
|
931 | "Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
|
932 | ) }
|
933 | }
|
934 |
|
935 | var listToStyles = __webpack_require__(10)
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 | var stylesInDom = { |
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 | }
|
957 |
|
958 | var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
|
959 | var singletonElement = null
|
960 | var singletonCounter = 0
|
961 | var isProduction = false
|
962 | var noop = function () {}
|
963 |
|
964 |
|
965 |
|
966 | var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
|
967 |
|
968 | module.exports = function (parentId, list, _isProduction) {
|
969 | isProduction = _isProduction
|
970 |
|
971 | var styles = listToStyles(parentId, list)
|
972 | addStylesToDom(styles)
|
973 |
|
974 | return function update (newList) {
|
975 | var mayRemove = []
|
976 | for (var i = 0; i < styles.length; i++) {
|
977 | var item = styles[i]
|
978 | var domStyle = stylesInDom[item.id]
|
979 | domStyle.refs--
|
980 | mayRemove.push(domStyle)
|
981 | }
|
982 | if (newList) {
|
983 | styles = listToStyles(parentId, newList)
|
984 | addStylesToDom(styles)
|
985 | } else {
|
986 | styles = []
|
987 | }
|
988 | for (var i = 0; i < mayRemove.length; i++) {
|
989 | var domStyle = mayRemove[i]
|
990 | if (domStyle.refs === 0) {
|
991 | for (var j = 0; j < domStyle.parts.length; j++) {
|
992 | domStyle.parts[j]()
|
993 | }
|
994 | delete stylesInDom[domStyle.id]
|
995 | }
|
996 | }
|
997 | }
|
998 | }
|
999 |
|
1000 | function addStylesToDom (styles /* Array<StyleObject> */) {
|
1001 | for (var i = 0; i < styles.length; i++) {
|
1002 | var item = styles[i]
|
1003 | var domStyle = stylesInDom[item.id]
|
1004 | if (domStyle) {
|
1005 | domStyle.refs++
|
1006 | for (var j = 0; j < domStyle.parts.length; j++) {
|
1007 | domStyle.parts[j](item.parts[j])
|
1008 | }
|
1009 | for (; j < item.parts.length; j++) {
|
1010 | domStyle.parts.push(addStyle(item.parts[j]))
|
1011 | }
|
1012 | if (domStyle.parts.length > item.parts.length) {
|
1013 | domStyle.parts.length = item.parts.length
|
1014 | }
|
1015 | } else {
|
1016 | var parts = []
|
1017 | for (var j = 0; j < item.parts.length; j++) {
|
1018 | parts.push(addStyle(item.parts[j]))
|
1019 | }
|
1020 | stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
|
1021 | }
|
1022 | }
|
1023 | }
|
1024 |
|
1025 | function createStyleElement () {
|
1026 | var styleElement = document.createElement('style')
|
1027 | styleElement.type = 'text/css'
|
1028 | head.appendChild(styleElement)
|
1029 | return styleElement
|
1030 | }
|
1031 |
|
1032 | function addStyle (obj /* StyleObjectPart */) {
|
1033 | var update, remove
|
1034 | var styleElement = document.querySelector('style[data-vue-ssr-id~="' + obj.id + '"]')
|
1035 |
|
1036 | if (styleElement) {
|
1037 | if (isProduction) {
|
1038 |
|
1039 |
|
1040 | return noop
|
1041 | } else {
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 | styleElement.parentNode.removeChild(styleElement)
|
1048 | }
|
1049 | }
|
1050 |
|
1051 | if (isOldIE) {
|
1052 |
|
1053 | var styleIndex = singletonCounter++
|
1054 | styleElement = singletonElement || (singletonElement = createStyleElement())
|
1055 | update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
|
1056 | remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
|
1057 | } else {
|
1058 |
|
1059 | styleElement = createStyleElement()
|
1060 | update = applyToTag.bind(null, styleElement)
|
1061 | remove = function () {
|
1062 | styleElement.parentNode.removeChild(styleElement)
|
1063 | }
|
1064 | }
|
1065 |
|
1066 | update(obj)
|
1067 |
|
1068 | return function updateStyle (newObj /* StyleObjectPart */) {
|
1069 | if (newObj) {
|
1070 | if (newObj.css === obj.css &&
|
1071 | newObj.media === obj.media &&
|
1072 | newObj.sourceMap === obj.sourceMap) {
|
1073 | return
|
1074 | }
|
1075 | update(obj = newObj)
|
1076 | } else {
|
1077 | remove()
|
1078 | }
|
1079 | }
|
1080 | }
|
1081 |
|
1082 | var replaceText = (function () {
|
1083 | var textStore = []
|
1084 |
|
1085 | return function (index, replacement) {
|
1086 | textStore[index] = replacement
|
1087 | return textStore.filter(Boolean).join('\n')
|
1088 | }
|
1089 | })()
|
1090 |
|
1091 | function applyToSingletonTag (styleElement, index, remove, obj) {
|
1092 | var css = remove ? '' : obj.css
|
1093 |
|
1094 | if (styleElement.styleSheet) {
|
1095 | styleElement.styleSheet.cssText = replaceText(index, css)
|
1096 | } else {
|
1097 | var cssNode = document.createTextNode(css)
|
1098 | var childNodes = styleElement.childNodes
|
1099 | if (childNodes[index]) styleElement.removeChild(childNodes[index])
|
1100 | if (childNodes.length) {
|
1101 | styleElement.insertBefore(cssNode, childNodes[index])
|
1102 | } else {
|
1103 | styleElement.appendChild(cssNode)
|
1104 | }
|
1105 | }
|
1106 | }
|
1107 |
|
1108 | function applyToTag (styleElement, obj) {
|
1109 | var css = obj.css
|
1110 | var media = obj.media
|
1111 | var sourceMap = obj.sourceMap
|
1112 |
|
1113 | if (media) {
|
1114 | styleElement.setAttribute('media', media)
|
1115 | }
|
1116 |
|
1117 | if (sourceMap) {
|
1118 |
|
1119 |
|
1120 | css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
|
1121 |
|
1122 | css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
|
1123 | }
|
1124 |
|
1125 | if (styleElement.styleSheet) {
|
1126 | styleElement.styleSheet.cssText = css
|
1127 | } else {
|
1128 | while (styleElement.firstChild) {
|
1129 | styleElement.removeChild(styleElement.firstChild)
|
1130 | }
|
1131 | styleElement.appendChild(document.createTextNode(css))
|
1132 | }
|
1133 | }
|
1134 |
|
1135 |
|
1136 | }),
|
1137 |
|
1138 | (function(module, exports) {
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 | module.exports = function listToStyles (parentId, list) {
|
1145 | var styles = []
|
1146 | var newStyles = {}
|
1147 | for (var i = 0; i < list.length; i++) {
|
1148 | var item = list[i]
|
1149 | var id = item[0]
|
1150 | var css = item[1]
|
1151 | var media = item[2]
|
1152 | var sourceMap = item[3]
|
1153 | var part = {
|
1154 | id: parentId + ':' + i,
|
1155 | css: css,
|
1156 | media: media,
|
1157 | sourceMap: sourceMap
|
1158 | }
|
1159 | if (!newStyles[id]) {
|
1160 | styles.push(newStyles[id] = { id: id, parts: [part] })
|
1161 | } else {
|
1162 | newStyles[id].parts.push(part)
|
1163 | }
|
1164 | }
|
1165 | return styles
|
1166 | }
|
1167 |
|
1168 |
|
1169 | }),
|
1170 |
|
1171 | (function(module, __webpack_exports__, __webpack_require__) {
|
1172 |
|
1173 | "use strict";
|
1174 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
1175 | var __WEBPACK_IMPORTED_MODULE_0__src_uploader_vue__ = __webpack_require__(0);
|
1176 | var __WEBPACK_IMPORTED_MODULE_0__src_uploader_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_uploader_vue__);
|
1177 | var __WEBPACK_IMPORTED_MODULE_1__src_wechat_uploader_js__ = __webpack_require__(1);
|
1178 | var __WEBPACK_IMPORTED_MODULE_1__src_wechat_uploader_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__src_wechat_uploader_js__);
|
1179 | __webpack_require__.d(__webpack_exports__, "Uploader", function() { return __WEBPACK_IMPORTED_MODULE_0__src_uploader_vue___default.a; });
|
1180 | __webpack_require__.d(__webpack_exports__, "WechatUploader", function() { return __WEBPACK_IMPORTED_MODULE_1__src_wechat_uploader_js___default.a; });
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 | })
|
1186 | ]);
|
1187 | }); |
\ | No newline at end of file |