1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
38 | __webpack_require__.d = function(exports, name, getter) {
|
39 | if(!__webpack_require__.o(exports, name)) {
|
40 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
41 | }
|
42 | };
|
43 |
|
44 |
|
45 | __webpack_require__.r = function(exports) {
|
46 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
47 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
48 | }
|
49 | Object.defineProperty(exports, '__esModule', { value: true });
|
50 | };
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | __webpack_require__.t = function(value, mode) {
|
58 | if(mode & 1) value = __webpack_require__(value);
|
59 | if(mode & 8) return value;
|
60 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
61 | var ns = Object.create(null);
|
62 | __webpack_require__.r(ns);
|
63 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
64 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
65 | return ns;
|
66 | };
|
67 |
|
68 |
|
69 | __webpack_require__.n = function(module) {
|
70 | var getter = module && module.__esModule ?
|
71 | function getDefault() { return module['default']; } :
|
72 | function getModuleExports() { return module; };
|
73 | __webpack_require__.d(getter, 'a', getter);
|
74 | return getter;
|
75 | };
|
76 |
|
77 |
|
78 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
79 |
|
80 |
|
81 | __webpack_require__.p = "/dist/";
|
82 |
|
83 |
|
84 |
|
85 | return __webpack_require__(__webpack_require__.s = 110);
|
86 | })
|
87 |
|
88 | ({
|
89 |
|
90 | 0:
|
91 | (function(module, __webpack_exports__, __webpack_require__) {
|
92 |
|
93 | "use strict";
|
94 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function normalizeComponent (
|
102 | scriptExports,
|
103 | render,
|
104 | staticRenderFns,
|
105 | functionalTemplate,
|
106 | injectStyles,
|
107 | scopeId,
|
108 | moduleIdentifier, /* server only */
|
109 | shadowMode /* vue-cli only */
|
110 | ) {
|
111 |
|
112 | var options = typeof scriptExports === 'function'
|
113 | ? scriptExports.options
|
114 | : scriptExports
|
115 |
|
116 |
|
117 | if (render) {
|
118 | options.render = render
|
119 | options.staticRenderFns = staticRenderFns
|
120 | options._compiled = true
|
121 | }
|
122 |
|
123 |
|
124 | if (functionalTemplate) {
|
125 | options.functional = true
|
126 | }
|
127 |
|
128 |
|
129 | if (scopeId) {
|
130 | options._scopeId = 'data-v-' + scopeId
|
131 | }
|
132 |
|
133 | var hook
|
134 | if (moduleIdentifier) {
|
135 | hook = function (context) {
|
136 |
|
137 | context =
|
138 | context ||
|
139 | (this.$vnode && this.$vnode.ssrContext) ||
|
140 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
141 |
|
142 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
143 | context = __VUE_SSR_CONTEXT__
|
144 | }
|
145 |
|
146 | if (injectStyles) {
|
147 | injectStyles.call(this, context)
|
148 | }
|
149 |
|
150 | if (context && context._registeredComponents) {
|
151 | context._registeredComponents.add(moduleIdentifier)
|
152 | }
|
153 | }
|
154 |
|
155 |
|
156 | options._ssrRegister = hook
|
157 | } else if (injectStyles) {
|
158 | hook = shadowMode
|
159 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
|
160 | : injectStyles
|
161 | }
|
162 |
|
163 | if (hook) {
|
164 | if (options.functional) {
|
165 |
|
166 |
|
167 | options._injectStyles = hook
|
168 |
|
169 | var originalRender = options.render
|
170 | options.render = function renderWithStyleInjection (h, context) {
|
171 | hook.call(context)
|
172 | return originalRender(h, context)
|
173 | }
|
174 | } else {
|
175 |
|
176 | var existing = options.beforeCreate
|
177 | options.beforeCreate = existing
|
178 | ? [].concat(existing, hook)
|
179 | : [hook]
|
180 | }
|
181 | }
|
182 |
|
183 | return {
|
184 | exports: scriptExports,
|
185 | options: options
|
186 | }
|
187 | }
|
188 |
|
189 |
|
190 | }),
|
191 |
|
192 | 110:
|
193 | (function(module, __webpack_exports__, __webpack_require__) {
|
194 |
|
195 | "use strict";
|
196 | __webpack_require__.r(__webpack_exports__);
|
197 |
|
198 |
|
199 | var render = function() {
|
200 | var _vm = this
|
201 | var _h = _vm.$createElement
|
202 | var _c = _vm._self._c || _h
|
203 | return _c(
|
204 | "div",
|
205 | {
|
206 | class: _vm.carouselClasses,
|
207 | on: {
|
208 | mouseenter: function($event) {
|
209 | $event.stopPropagation()
|
210 | return _vm.handleMouseEnter($event)
|
211 | },
|
212 | mouseleave: function($event) {
|
213 | $event.stopPropagation()
|
214 | return _vm.handleMouseLeave($event)
|
215 | }
|
216 | }
|
217 | },
|
218 | [
|
219 | _c(
|
220 | "div",
|
221 | {
|
222 | staticClass: "el-carousel__container",
|
223 | style: { height: _vm.height }
|
224 | },
|
225 | [
|
226 | _vm.arrowDisplay
|
227 | ? _c("transition", { attrs: { name: "carousel-arrow-left" } }, [
|
228 | _c(
|
229 | "button",
|
230 | {
|
231 | directives: [
|
232 | {
|
233 | name: "show",
|
234 | rawName: "v-show",
|
235 | value:
|
236 | (_vm.arrow === "always" || _vm.hover) &&
|
237 | (_vm.loop || _vm.activeIndex > 0),
|
238 | expression:
|
239 | "(arrow === 'always' || hover) && (loop || activeIndex > 0)"
|
240 | }
|
241 | ],
|
242 | staticClass: "el-carousel__arrow el-carousel__arrow--left",
|
243 | attrs: { type: "button" },
|
244 | on: {
|
245 | mouseenter: function($event) {
|
246 | _vm.handleButtonEnter("left")
|
247 | },
|
248 | mouseleave: _vm.handleButtonLeave,
|
249 | click: function($event) {
|
250 | $event.stopPropagation()
|
251 | _vm.throttledArrowClick(_vm.activeIndex - 1)
|
252 | }
|
253 | }
|
254 | },
|
255 | [_c("i", { staticClass: "el-icon-arrow-left" })]
|
256 | )
|
257 | ])
|
258 | : _vm._e(),
|
259 | _vm.arrowDisplay
|
260 | ? _c("transition", { attrs: { name: "carousel-arrow-right" } }, [
|
261 | _c(
|
262 | "button",
|
263 | {
|
264 | directives: [
|
265 | {
|
266 | name: "show",
|
267 | rawName: "v-show",
|
268 | value:
|
269 | (_vm.arrow === "always" || _vm.hover) &&
|
270 | (_vm.loop || _vm.activeIndex < _vm.items.length - 1),
|
271 | expression:
|
272 | "(arrow === 'always' || hover) && (loop || activeIndex < items.length - 1)"
|
273 | }
|
274 | ],
|
275 | staticClass: "el-carousel__arrow el-carousel__arrow--right",
|
276 | attrs: { type: "button" },
|
277 | on: {
|
278 | mouseenter: function($event) {
|
279 | _vm.handleButtonEnter("right")
|
280 | },
|
281 | mouseleave: _vm.handleButtonLeave,
|
282 | click: function($event) {
|
283 | $event.stopPropagation()
|
284 | _vm.throttledArrowClick(_vm.activeIndex + 1)
|
285 | }
|
286 | }
|
287 | },
|
288 | [_c("i", { staticClass: "el-icon-arrow-right" })]
|
289 | )
|
290 | ])
|
291 | : _vm._e(),
|
292 | _vm._t("default")
|
293 | ],
|
294 | 2
|
295 | ),
|
296 | _vm.indicatorPosition !== "none"
|
297 | ? _c(
|
298 | "ul",
|
299 | { class: _vm.indicatorsClasses },
|
300 | _vm._l(_vm.items, function(item, index) {
|
301 | return _c(
|
302 | "li",
|
303 | {
|
304 | key: index,
|
305 | class: [
|
306 | "el-carousel__indicator",
|
307 | "el-carousel__indicator--" + _vm.direction,
|
308 | { "is-active": index === _vm.activeIndex }
|
309 | ],
|
310 | on: {
|
311 | mouseenter: function($event) {
|
312 | _vm.throttledIndicatorHover(index)
|
313 | },
|
314 | click: function($event) {
|
315 | $event.stopPropagation()
|
316 | _vm.handleIndicatorClick(index)
|
317 | }
|
318 | }
|
319 | },
|
320 | [
|
321 | _c("button", { staticClass: "el-carousel__button" }, [
|
322 | _vm.hasLabel
|
323 | ? _c("span", [_vm._v(_vm._s(item.label))])
|
324 | : _vm._e()
|
325 | ])
|
326 | ]
|
327 | )
|
328 | }),
|
329 | 0
|
330 | )
|
331 | : _vm._e()
|
332 | ]
|
333 | )
|
334 | }
|
335 | var staticRenderFns = []
|
336 | render._withStripped = true
|
337 |
|
338 |
|
339 |
|
340 |
|
341 |
|
342 | var throttle_ = __webpack_require__(25);
|
343 | var throttle_default = __webpack_require__.n(throttle_);
|
344 |
|
345 |
|
346 | var resize_event_ = __webpack_require__(16);
|
347 |
|
348 |
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 |
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 | var mainvue_type_script_lang_js_ = ({
|
410 | name: 'ElCarousel',
|
411 |
|
412 | props: {
|
413 | initialIndex: {
|
414 | type: Number,
|
415 | default: 0
|
416 | },
|
417 | height: String,
|
418 | trigger: {
|
419 | type: String,
|
420 | default: 'hover'
|
421 | },
|
422 | autoplay: {
|
423 | type: Boolean,
|
424 | default: true
|
425 | },
|
426 | interval: {
|
427 | type: Number,
|
428 | default: 3000
|
429 | },
|
430 | indicatorPosition: String,
|
431 | indicator: {
|
432 | type: Boolean,
|
433 | default: true
|
434 | },
|
435 | arrow: {
|
436 | type: String,
|
437 | default: 'hover'
|
438 | },
|
439 | type: String,
|
440 | loop: {
|
441 | type: Boolean,
|
442 | default: true
|
443 | },
|
444 | direction: {
|
445 | type: String,
|
446 | default: 'horizontal',
|
447 | validator: function validator(val) {
|
448 | return ['horizontal', 'vertical'].indexOf(val) !== -1;
|
449 | }
|
450 | }
|
451 | },
|
452 |
|
453 | data: function data() {
|
454 | return {
|
455 | items: [],
|
456 | activeIndex: -1,
|
457 | containerWidth: 0,
|
458 | timer: null,
|
459 | hover: false
|
460 | };
|
461 | },
|
462 |
|
463 |
|
464 | computed: {
|
465 | arrowDisplay: function arrowDisplay() {
|
466 | return this.arrow !== 'never' && this.direction !== 'vertical';
|
467 | },
|
468 | hasLabel: function hasLabel() {
|
469 | return this.items.some(function (item) {
|
470 | return item.label.toString().length > 0;
|
471 | });
|
472 | },
|
473 | carouselClasses: function carouselClasses() {
|
474 | var classes = ['el-carousel', 'el-carousel--' + this.direction];
|
475 | if (this.type === 'card') {
|
476 | classes.push('el-carousel--card');
|
477 | }
|
478 | return classes;
|
479 | },
|
480 | indicatorsClasses: function indicatorsClasses() {
|
481 | var classes = ['el-carousel__indicators', 'el-carousel__indicators--' + this.direction];
|
482 | if (this.hasLabel) {
|
483 | classes.push('el-carousel__indicators--labels');
|
484 | }
|
485 | if (this.indicatorPosition === 'outside' || this.type === 'card') {
|
486 | classes.push('el-carousel__indicators--outside');
|
487 | }
|
488 | return classes;
|
489 | }
|
490 | },
|
491 |
|
492 | watch: {
|
493 | items: function items(val) {
|
494 | if (val.length > 0) this.setActiveItem(this.initialIndex);
|
495 | },
|
496 | activeIndex: function activeIndex(val, oldVal) {
|
497 | this.resetItemPosition(oldVal);
|
498 | if (oldVal > -1) {
|
499 | this.$emit('change', val, oldVal);
|
500 | }
|
501 | },
|
502 | autoplay: function autoplay(val) {
|
503 | val ? this.startTimer() : this.pauseTimer();
|
504 | },
|
505 | loop: function loop() {
|
506 | this.setActiveItem(this.activeIndex);
|
507 | },
|
508 | interval: function interval() {
|
509 | this.pauseTimer();
|
510 | this.startTimer();
|
511 | }
|
512 | },
|
513 |
|
514 | methods: {
|
515 | handleMouseEnter: function handleMouseEnter() {
|
516 | this.hover = true;
|
517 | this.pauseTimer();
|
518 | },
|
519 | handleMouseLeave: function handleMouseLeave() {
|
520 | this.hover = false;
|
521 | this.startTimer();
|
522 | },
|
523 | itemInStage: function itemInStage(item, index) {
|
524 | var length = this.items.length;
|
525 | if (index === length - 1 && item.inStage && this.items[0].active || item.inStage && this.items[index + 1] && this.items[index + 1].active) {
|
526 | return 'left';
|
527 | } else if (index === 0 && item.inStage && this.items[length - 1].active || item.inStage && this.items[index - 1] && this.items[index - 1].active) {
|
528 | return 'right';
|
529 | }
|
530 | return false;
|
531 | },
|
532 | handleButtonEnter: function handleButtonEnter(arrow) {
|
533 | var _this = this;
|
534 |
|
535 | if (this.direction === 'vertical') return;
|
536 | this.items.forEach(function (item, index) {
|
537 | if (arrow === _this.itemInStage(item, index)) {
|
538 | item.hover = true;
|
539 | }
|
540 | });
|
541 | },
|
542 | handleButtonLeave: function handleButtonLeave() {
|
543 | if (this.direction === 'vertical') return;
|
544 | this.items.forEach(function (item) {
|
545 | item.hover = false;
|
546 | });
|
547 | },
|
548 | updateItems: function updateItems() {
|
549 | this.items = this.$children.filter(function (child) {
|
550 | return child.$options.name === 'ElCarouselItem';
|
551 | });
|
552 | },
|
553 | resetItemPosition: function resetItemPosition(oldIndex) {
|
554 | var _this2 = this;
|
555 |
|
556 | this.items.forEach(function (item, index) {
|
557 | item.translateItem(index, _this2.activeIndex, oldIndex);
|
558 | });
|
559 | },
|
560 | playSlides: function playSlides() {
|
561 | if (this.activeIndex < this.items.length - 1) {
|
562 | this.activeIndex++;
|
563 | } else if (this.loop) {
|
564 | this.activeIndex = 0;
|
565 | }
|
566 | },
|
567 | pauseTimer: function pauseTimer() {
|
568 | if (this.timer) {
|
569 | clearInterval(this.timer);
|
570 | this.timer = null;
|
571 | }
|
572 | },
|
573 | startTimer: function startTimer() {
|
574 | if (this.interval <= 0 || !this.autoplay || this.timer) return;
|
575 | this.timer = setInterval(this.playSlides, this.interval);
|
576 | },
|
577 | resetTimer: function resetTimer() {
|
578 | this.pauseTimer();
|
579 | this.startTimer();
|
580 | },
|
581 | setActiveItem: function setActiveItem(index) {
|
582 | if (typeof index === 'string') {
|
583 | var filteredItems = this.items.filter(function (item) {
|
584 | return item.name === index;
|
585 | });
|
586 | if (filteredItems.length > 0) {
|
587 | index = this.items.indexOf(filteredItems[0]);
|
588 | }
|
589 | }
|
590 | index = Number(index);
|
591 | if (isNaN(index) || index !== Math.floor(index)) {
|
592 | console.warn('[Element Warn][Carousel]index must be an integer.');
|
593 | return;
|
594 | }
|
595 | var length = this.items.length;
|
596 | var oldIndex = this.activeIndex;
|
597 | if (index < 0) {
|
598 | this.activeIndex = this.loop ? length - 1 : 0;
|
599 | } else if (index >= length) {
|
600 | this.activeIndex = this.loop ? 0 : length - 1;
|
601 | } else {
|
602 | this.activeIndex = index;
|
603 | }
|
604 | if (oldIndex === this.activeIndex) {
|
605 | this.resetItemPosition(oldIndex);
|
606 | }
|
607 | this.resetTimer();
|
608 | },
|
609 | prev: function prev() {
|
610 | this.setActiveItem(this.activeIndex - 1);
|
611 | },
|
612 | next: function next() {
|
613 | this.setActiveItem(this.activeIndex + 1);
|
614 | },
|
615 | handleIndicatorClick: function handleIndicatorClick(index) {
|
616 | this.activeIndex = index;
|
617 | },
|
618 | handleIndicatorHover: function handleIndicatorHover(index) {
|
619 | if (this.trigger === 'hover' && index !== this.activeIndex) {
|
620 | this.activeIndex = index;
|
621 | }
|
622 | }
|
623 | },
|
624 |
|
625 | created: function created() {
|
626 | var _this3 = this;
|
627 |
|
628 | this.throttledArrowClick = throttle_default()(300, true, function (index) {
|
629 | _this3.setActiveItem(index);
|
630 | });
|
631 | this.throttledIndicatorHover = throttle_default()(300, function (index) {
|
632 | _this3.handleIndicatorHover(index);
|
633 | });
|
634 | },
|
635 | mounted: function mounted() {
|
636 | var _this4 = this;
|
637 |
|
638 | this.updateItems();
|
639 | this.$nextTick(function () {
|
640 | Object(resize_event_["addResizeListener"])(_this4.$el, _this4.resetItemPosition);
|
641 | if (_this4.initialIndex < _this4.items.length && _this4.initialIndex >= 0) {
|
642 | _this4.activeIndex = _this4.initialIndex;
|
643 | }
|
644 | _this4.startTimer();
|
645 | });
|
646 | },
|
647 | beforeDestroy: function beforeDestroy() {
|
648 | if (this.$el) Object(resize_event_["removeResizeListener"])(this.$el, this.resetItemPosition);
|
649 | this.pauseTimer();
|
650 | }
|
651 | });
|
652 |
|
653 | var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
|
654 |
|
655 | var componentNormalizer = __webpack_require__(0);
|
656 |
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 | var component = Object(componentNormalizer["a" ])(
|
666 | src_mainvue_type_script_lang_js_,
|
667 | render,
|
668 | staticRenderFns,
|
669 | false,
|
670 | null,
|
671 | null,
|
672 | null
|
673 |
|
674 | )
|
675 |
|
676 |
|
677 | if (false) { var api; }
|
678 | component.options.__file = "packages/carousel/src/main.vue"
|
679 | var main = (component.exports);
|
680 |
|
681 |
|
682 |
|
683 |
|
684 | main.install = function (Vue) {
|
685 | Vue.component(main.name, main);
|
686 | };
|
687 |
|
688 | var carousel = __webpack_exports__["default"] = (main);
|
689 |
|
690 | }),
|
691 |
|
692 | 16:
|
693 | (function(module, exports) {
|
694 |
|
695 | module.exports = require("element-ui/lib/utils/resize-event");
|
696 |
|
697 | }),
|
698 |
|
699 | 25:
|
700 | (function(module, exports) {
|
701 |
|
702 | module.exports = require("throttle-debounce/throttle");
|
703 |
|
704 | })
|
705 |
|
706 | }); |
\ | No newline at end of file |