@wanjunshijie/vue-seamless-scroll 2.0.0 → 3.0.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.
@@ -1,903 +0,0 @@
1
- /******/ (function() { // webpackBootstrap
2
- /******/ var __webpack_modules__ = ({
3
-
4
- /***/ 567:
5
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
6
-
7
- "use strict";
8
- __webpack_require__.r(__webpack_exports__);
9
- /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(81);
10
- /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
11
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(645);
12
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
13
- // Imports
14
-
15
-
16
- var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
17
- // Module
18
- ___CSS_LOADER_EXPORT___.push([module.id, ".seamless-list[data-v-44bde8d8]{touch-action:none}.seamless-list[data-v-44bde8d8],.seamless-list__body[data-v-44bde8d8]{overflow:hidden}.seamless-list__body.is-horizontal[data-v-44bde8d8]{display:inline-block;font-size:0}", ""]);
19
- // Exports
20
- /* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
21
-
22
-
23
- /***/ }),
24
-
25
- /***/ 645:
26
- /***/ (function(module) {
27
-
28
- "use strict";
29
-
30
-
31
- /*
32
- MIT License http://www.opensource.org/licenses/mit-license.php
33
- Author Tobias Koppers @sokra
34
- */
35
- module.exports = function (cssWithMappingToString) {
36
- var list = [];
37
-
38
- // return the list of modules as css string
39
- list.toString = function toString() {
40
- return this.map(function (item) {
41
- var content = "";
42
- var needLayer = typeof item[5] !== "undefined";
43
- if (item[4]) {
44
- content += "@supports (".concat(item[4], ") {");
45
- }
46
- if (item[2]) {
47
- content += "@media ".concat(item[2], " {");
48
- }
49
- if (needLayer) {
50
- content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
51
- }
52
- content += cssWithMappingToString(item);
53
- if (needLayer) {
54
- content += "}";
55
- }
56
- if (item[2]) {
57
- content += "}";
58
- }
59
- if (item[4]) {
60
- content += "}";
61
- }
62
- return content;
63
- }).join("");
64
- };
65
-
66
- // import a list of modules into the list
67
- list.i = function i(modules, media, dedupe, supports, layer) {
68
- if (typeof modules === "string") {
69
- modules = [[null, modules, undefined]];
70
- }
71
- var alreadyImportedModules = {};
72
- if (dedupe) {
73
- for (var k = 0; k < this.length; k++) {
74
- var id = this[k][0];
75
- if (id != null) {
76
- alreadyImportedModules[id] = true;
77
- }
78
- }
79
- }
80
- for (var _k = 0; _k < modules.length; _k++) {
81
- var item = [].concat(modules[_k]);
82
- if (dedupe && alreadyImportedModules[item[0]]) {
83
- continue;
84
- }
85
- if (typeof layer !== "undefined") {
86
- if (typeof item[5] === "undefined") {
87
- item[5] = layer;
88
- } else {
89
- item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
90
- item[5] = layer;
91
- }
92
- }
93
- if (media) {
94
- if (!item[2]) {
95
- item[2] = media;
96
- } else {
97
- item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
98
- item[2] = media;
99
- }
100
- }
101
- if (supports) {
102
- if (!item[4]) {
103
- item[4] = "".concat(supports);
104
- } else {
105
- item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
106
- item[4] = supports;
107
- }
108
- }
109
- list.push(item);
110
- }
111
- };
112
- return list;
113
- };
114
-
115
- /***/ }),
116
-
117
- /***/ 81:
118
- /***/ (function(module) {
119
-
120
- "use strict";
121
-
122
-
123
- module.exports = function (i) {
124
- return i[1];
125
- };
126
-
127
- /***/ }),
128
-
129
- /***/ 179:
130
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
131
-
132
- // style-loader: Adds some css to the DOM by adding a <style> tag
133
-
134
- // load the styles
135
- var content = __webpack_require__(567);
136
- if(content.__esModule) content = content.default;
137
- if(typeof content === 'string') content = [[module.id, content, '']];
138
- if(content.locals) module.exports = content.locals;
139
- // add the styles to the DOM
140
- var add = (__webpack_require__(402)/* ["default"] */ .Z)
141
- var update = add("7ede6155", content, true, {"sourceMap":false,"shadowMode":false});
142
-
143
- /***/ }),
144
-
145
- /***/ 402:
146
- /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
147
-
148
- "use strict";
149
-
150
- // EXPORTS
151
- __webpack_require__.d(__webpack_exports__, {
152
- Z: function() { return /* binding */ addStylesClient; }
153
- });
154
-
155
- ;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/listToStyles.js
156
- /**
157
- * Translates the list format produced by css-loader into something
158
- * easier to manipulate.
159
- */
160
- function listToStyles (parentId, list) {
161
- var styles = []
162
- var newStyles = {}
163
- for (var i = 0; i < list.length; i++) {
164
- var item = list[i]
165
- var id = item[0]
166
- var css = item[1]
167
- var media = item[2]
168
- var sourceMap = item[3]
169
- var part = {
170
- id: parentId + ':' + i,
171
- css: css,
172
- media: media,
173
- sourceMap: sourceMap
174
- }
175
- if (!newStyles[id]) {
176
- styles.push(newStyles[id] = { id: id, parts: [part] })
177
- } else {
178
- newStyles[id].parts.push(part)
179
- }
180
- }
181
- return styles
182
- }
183
-
184
- ;// CONCATENATED MODULE: ./node_modules/vue-style-loader/lib/addStylesClient.js
185
- /*
186
- MIT License http://www.opensource.org/licenses/mit-license.php
187
- Author Tobias Koppers @sokra
188
- Modified by Evan You @yyx990803
189
- */
190
-
191
-
192
-
193
- var hasDocument = typeof document !== 'undefined'
194
-
195
- if (typeof DEBUG !== 'undefined' && DEBUG) {
196
- if (!hasDocument) {
197
- throw new Error(
198
- 'vue-style-loader cannot be used in a non-browser environment. ' +
199
- "Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
200
- ) }
201
- }
202
-
203
- /*
204
- type StyleObject = {
205
- id: number;
206
- parts: Array<StyleObjectPart>
207
- }
208
-
209
- type StyleObjectPart = {
210
- css: string;
211
- media: string;
212
- sourceMap: ?string
213
- }
214
- */
215
-
216
- var stylesInDom = {/*
217
- [id: number]: {
218
- id: number,
219
- refs: number,
220
- parts: Array<(obj?: StyleObjectPart) => void>
221
- }
222
- */}
223
-
224
- var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
225
- var singletonElement = null
226
- var singletonCounter = 0
227
- var isProduction = false
228
- var noop = function () {}
229
- var options = null
230
- var ssrIdKey = 'data-vue-ssr-id'
231
-
232
- // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
233
- // tags it will allow on a page
234
- var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
235
-
236
- function addStylesClient (parentId, list, _isProduction, _options) {
237
- isProduction = _isProduction
238
-
239
- options = _options || {}
240
-
241
- var styles = listToStyles(parentId, list)
242
- addStylesToDom(styles)
243
-
244
- return function update (newList) {
245
- var mayRemove = []
246
- for (var i = 0; i < styles.length; i++) {
247
- var item = styles[i]
248
- var domStyle = stylesInDom[item.id]
249
- domStyle.refs--
250
- mayRemove.push(domStyle)
251
- }
252
- if (newList) {
253
- styles = listToStyles(parentId, newList)
254
- addStylesToDom(styles)
255
- } else {
256
- styles = []
257
- }
258
- for (var i = 0; i < mayRemove.length; i++) {
259
- var domStyle = mayRemove[i]
260
- if (domStyle.refs === 0) {
261
- for (var j = 0; j < domStyle.parts.length; j++) {
262
- domStyle.parts[j]()
263
- }
264
- delete stylesInDom[domStyle.id]
265
- }
266
- }
267
- }
268
- }
269
-
270
- function addStylesToDom (styles /* Array<StyleObject> */) {
271
- for (var i = 0; i < styles.length; i++) {
272
- var item = styles[i]
273
- var domStyle = stylesInDom[item.id]
274
- if (domStyle) {
275
- domStyle.refs++
276
- for (var j = 0; j < domStyle.parts.length; j++) {
277
- domStyle.parts[j](item.parts[j])
278
- }
279
- for (; j < item.parts.length; j++) {
280
- domStyle.parts.push(addStyle(item.parts[j]))
281
- }
282
- if (domStyle.parts.length > item.parts.length) {
283
- domStyle.parts.length = item.parts.length
284
- }
285
- } else {
286
- var parts = []
287
- for (var j = 0; j < item.parts.length; j++) {
288
- parts.push(addStyle(item.parts[j]))
289
- }
290
- stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
291
- }
292
- }
293
- }
294
-
295
- function createStyleElement () {
296
- var styleElement = document.createElement('style')
297
- styleElement.type = 'text/css'
298
- head.appendChild(styleElement)
299
- return styleElement
300
- }
301
-
302
- function addStyle (obj /* StyleObjectPart */) {
303
- var update, remove
304
- var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
305
-
306
- if (styleElement) {
307
- if (isProduction) {
308
- // has SSR styles and in production mode.
309
- // simply do nothing.
310
- return noop
311
- } else {
312
- // has SSR styles but in dev mode.
313
- // for some reason Chrome can't handle source map in server-rendered
314
- // style tags - source maps in <style> only works if the style tag is
315
- // created and inserted dynamically. So we remove the server rendered
316
- // styles and inject new ones.
317
- styleElement.parentNode.removeChild(styleElement)
318
- }
319
- }
320
-
321
- if (isOldIE) {
322
- // use singleton mode for IE9.
323
- var styleIndex = singletonCounter++
324
- styleElement = singletonElement || (singletonElement = createStyleElement())
325
- update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
326
- remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
327
- } else {
328
- // use multi-style-tag mode in all other cases
329
- styleElement = createStyleElement()
330
- update = applyToTag.bind(null, styleElement)
331
- remove = function () {
332
- styleElement.parentNode.removeChild(styleElement)
333
- }
334
- }
335
-
336
- update(obj)
337
-
338
- return function updateStyle (newObj /* StyleObjectPart */) {
339
- if (newObj) {
340
- if (newObj.css === obj.css &&
341
- newObj.media === obj.media &&
342
- newObj.sourceMap === obj.sourceMap) {
343
- return
344
- }
345
- update(obj = newObj)
346
- } else {
347
- remove()
348
- }
349
- }
350
- }
351
-
352
- var replaceText = (function () {
353
- var textStore = []
354
-
355
- return function (index, replacement) {
356
- textStore[index] = replacement
357
- return textStore.filter(Boolean).join('\n')
358
- }
359
- })()
360
-
361
- function applyToSingletonTag (styleElement, index, remove, obj) {
362
- var css = remove ? '' : obj.css
363
-
364
- if (styleElement.styleSheet) {
365
- styleElement.styleSheet.cssText = replaceText(index, css)
366
- } else {
367
- var cssNode = document.createTextNode(css)
368
- var childNodes = styleElement.childNodes
369
- if (childNodes[index]) styleElement.removeChild(childNodes[index])
370
- if (childNodes.length) {
371
- styleElement.insertBefore(cssNode, childNodes[index])
372
- } else {
373
- styleElement.appendChild(cssNode)
374
- }
375
- }
376
- }
377
-
378
- function applyToTag (styleElement, obj) {
379
- var css = obj.css
380
- var media = obj.media
381
- var sourceMap = obj.sourceMap
382
-
383
- if (media) {
384
- styleElement.setAttribute('media', media)
385
- }
386
- if (options.ssrId) {
387
- styleElement.setAttribute(ssrIdKey, obj.id)
388
- }
389
-
390
- if (sourceMap) {
391
- // https://developer.chrome.com/devtools/docs/javascript-debugging
392
- // this makes source maps inside style tags work properly in Chrome
393
- css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
394
- // http://stackoverflow.com/a/26603875
395
- css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
396
- }
397
-
398
- if (styleElement.styleSheet) {
399
- styleElement.styleSheet.cssText = css
400
- } else {
401
- while (styleElement.firstChild) {
402
- styleElement.removeChild(styleElement.firstChild)
403
- }
404
- styleElement.appendChild(document.createTextNode(css))
405
- }
406
- }
407
-
408
-
409
- /***/ })
410
-
411
- /******/ });
412
- /************************************************************************/
413
- /******/ // The module cache
414
- /******/ var __webpack_module_cache__ = {};
415
- /******/
416
- /******/ // The require function
417
- /******/ function __webpack_require__(moduleId) {
418
- /******/ // Check if module is in cache
419
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
420
- /******/ if (cachedModule !== undefined) {
421
- /******/ return cachedModule.exports;
422
- /******/ }
423
- /******/ // Create a new module (and put it into the cache)
424
- /******/ var module = __webpack_module_cache__[moduleId] = {
425
- /******/ id: moduleId,
426
- /******/ // no module.loaded needed
427
- /******/ exports: {}
428
- /******/ };
429
- /******/
430
- /******/ // Execute the module function
431
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
432
- /******/
433
- /******/ // Return the exports of the module
434
- /******/ return module.exports;
435
- /******/ }
436
- /******/
437
- /************************************************************************/
438
- /******/ /* webpack/runtime/compat get default export */
439
- /******/ !function() {
440
- /******/ // getDefaultExport function for compatibility with non-harmony modules
441
- /******/ __webpack_require__.n = function(module) {
442
- /******/ var getter = module && module.__esModule ?
443
- /******/ function() { return module['default']; } :
444
- /******/ function() { return module; };
445
- /******/ __webpack_require__.d(getter, { a: getter });
446
- /******/ return getter;
447
- /******/ };
448
- /******/ }();
449
- /******/
450
- /******/ /* webpack/runtime/define property getters */
451
- /******/ !function() {
452
- /******/ // define getter functions for harmony exports
453
- /******/ __webpack_require__.d = function(exports, definition) {
454
- /******/ for(var key in definition) {
455
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
456
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
457
- /******/ }
458
- /******/ }
459
- /******/ };
460
- /******/ }();
461
- /******/
462
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
463
- /******/ !function() {
464
- /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
465
- /******/ }();
466
- /******/
467
- /******/ /* webpack/runtime/make namespace object */
468
- /******/ !function() {
469
- /******/ // define __esModule on exports
470
- /******/ __webpack_require__.r = function(exports) {
471
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
472
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
473
- /******/ }
474
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
475
- /******/ };
476
- /******/ }();
477
- /******/
478
- /******/ /* webpack/runtime/publicPath */
479
- /******/ !function() {
480
- /******/ __webpack_require__.p = "";
481
- /******/ }();
482
- /******/
483
- /************************************************************************/
484
- var __webpack_exports__ = {};
485
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
486
- !function() {
487
- "use strict";
488
- // ESM COMPAT FLAG
489
- __webpack_require__.r(__webpack_exports__);
490
-
491
- // EXPORTS
492
- __webpack_require__.d(__webpack_exports__, {
493
- "default": function() { return /* binding */ entry_lib; }
494
- });
495
-
496
- ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
497
- /* eslint-disable no-var */
498
- // This file is imported into lib/wc client bundles.
499
-
500
- if (typeof window !== 'undefined') {
501
- var currentScript = window.document.currentScript
502
- if (false) { var getCurrentScript; }
503
-
504
- var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
505
- if (src) {
506
- __webpack_require__.p = src[1] // eslint-disable-line
507
- }
508
- }
509
-
510
- // Indicate to webpack that this file can be concatenated
511
- /* harmony default export */ var setPublicPath = (null);
512
-
513
- ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/vue-seamless-scroll/index.vue?vue&type=template&id=44bde8d8&scoped=true
514
- var render = function render() {
515
- var _vm = this,
516
- _c = _vm._self._c;
517
- return _c('div', {
518
- ref: "scrollBody",
519
- staticClass: "seamless-list",
520
- on: {
521
- "mouseenter": _vm.onMouseenter,
522
- "mouseleave": _vm.onMouseleave,
523
- "wheel": _vm.onWheel,
524
- "touchstart": _vm.onTouchStart,
525
- "touchmove": _vm.onTouchMove,
526
- "touchend": _vm.onTouchEnd,
527
- "touchcancel": _vm.onTouchEnd
528
- }
529
- }, [_c('div', {
530
- ref: "listBody",
531
- staticClass: "seamless-list__body",
532
- class: {
533
- 'is-horizontal': _vm.isHorizontal
534
- },
535
- style: {
536
- transform: _vm.getScrollStyle()
537
- }
538
- }, [_vm._t("default")], 2), _vm.canScroll ? _c('div', {
539
- staticClass: "seamless-list__body",
540
- class: {
541
- 'is-horizontal': _vm.isHorizontal
542
- },
543
- style: {
544
- transform: _vm.getScrollStyle()
545
- }
546
- }, [_vm._t("default")], 2) : _vm._e()]);
547
- };
548
- var staticRenderFns = [];
549
-
550
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/babel-loader/lib/index.js!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/vue-seamless-scroll/index.vue?vue&type=script&lang=js
551
- /* harmony default export */ var vue_seamless_scrollvue_type_script_lang_js = ({
552
- name: 'VueSeamlessScroll',
553
- props: {
554
- // 滚动方向
555
- direction: {
556
- type: String,
557
- default: 'top'
558
- },
559
- // 滚动速度
560
- steep: {
561
- type: Number,
562
- default: 0.5
563
- },
564
- // 是否可以滑轮滚动
565
- roller: {
566
- type: Boolean,
567
- default: true
568
- },
569
- // 滑轮滚动的距离
570
- distance: {
571
- type: Number,
572
- default: 20
573
- },
574
- data: Array
575
- },
576
- data() {
577
- return {
578
- listWidth: 0,
579
- listHeight: 0,
580
- bodyWidth: 0,
581
- bodyHeight: 0,
582
- canScroll: false,
583
- isStop: false,
584
- scrollDistance: 0,
585
- animationFrame: null,
586
- touchStartX: 0,
587
- touchStartY: 0,
588
- touchStartDistance: 0
589
- };
590
- },
591
- computed: {
592
- isHorizontal() {
593
- return this.direction === 'left' || this.direction === 'right';
594
- }
595
- },
596
- watch: {
597
- data: {
598
- handler() {
599
- this.$nextTick(() => {
600
- this.initData();
601
- });
602
- },
603
- deep: true
604
- }
605
- },
606
- mounted() {
607
- this.$nextTick(() => {
608
- this.initData();
609
- });
610
- },
611
- destroyed() {
612
- this.stop();
613
- },
614
- methods: {
615
- initData() {
616
- this.stop();
617
- this.$nextTick(() => {
618
- this.listWidth = this.$refs.listBody ? this.$refs.listBody.clientWidth : 0;
619
- this.listHeight = this.$refs.listBody ? this.$refs.listBody.clientHeight : 0;
620
- this.bodyWidth = this.$refs.scrollBody ? this.$refs.scrollBody.clientWidth : 0;
621
- this.bodyHeight = this.$refs.scrollBody ? this.$refs.scrollBody.clientHeight : 0;
622
- this.scrollDistance = 0;
623
- this.start();
624
- });
625
- },
626
- start() {
627
- this.isStop = false;
628
- if (this.isHorizontal) {
629
- this.getCanScroll(this.listWidth, this.bodyWidth);
630
- } else {
631
- this.getCanScroll(this.listHeight, this.bodyHeight);
632
- }
633
- if (this.canScroll) {
634
- this.run();
635
- }
636
- },
637
- run() {
638
- let that = this;
639
- this.clearAnimation();
640
- if (this.steep == 0) {
641
- this.setScrollDistance();
642
- return;
643
- }
644
- this.animationFrame = window.requestAnimationFrame(() => {
645
- that.setScrollDistance();
646
- if (!that.isStop) {
647
- if (that.direction === 'top' || that.direction === 'left') {
648
- that.scrollDistance -= that.steep;
649
- } else if (that.direction === 'bottom' || that.direction === 'right') {
650
- that.scrollDistance += that.steep;
651
- }
652
- that.run();
653
- }
654
- });
655
- },
656
- stop() {
657
- this.isStop = true;
658
- this.clearAnimation();
659
- },
660
- getCanScroll(listSize, bodySize) {
661
- this.canScroll = listSize && bodySize && listSize > bodySize;
662
- },
663
- setScrollDistance() {
664
- if (this.isHorizontal) {
665
- this.getScrollDistance(this.listWidth, this.bodyWidth);
666
- } else {
667
- this.getScrollDistance(this.listHeight, this.bodyHeight);
668
- }
669
- },
670
- getScrollDistance(listSize, bodySize) {
671
- let scrollDistance = Math.abs(this.scrollDistance);
672
- if (this.scrollDistance < 0) {
673
- let size = 2 * listSize - bodySize;
674
- if (scrollDistance > size) {
675
- this.scrollDistance = -(listSize - bodySize);
676
- }
677
- } else {
678
- this.scrollDistance = -listSize;
679
- }
680
- },
681
- getScrollStyle() {
682
- let style = '';
683
- if (!this.isHorizontal) {
684
- style = `translate(0, ${this.scrollDistance}px)`;
685
- } else {
686
- style = `translate(${this.scrollDistance}px, 0)`;
687
- }
688
- return style;
689
- },
690
- clearAnimation() {
691
- if (this.animationFrame) {
692
- cancelAnimationFrame(this.animationFrame);
693
- this.animationFrame = null;
694
- }
695
- },
696
- onMouseenter() {
697
- this.stop();
698
- },
699
- onMouseleave() {
700
- this.start();
701
- },
702
- onWheel(e) {
703
- e.preventDefault();
704
- if (!this.canScroll || !this.roller) {
705
- return false;
706
- }
707
- let dis = e.deltaY;
708
- if (dis > 0) {
709
- this.scrollDistance -= this.distance;
710
- } else {
711
- this.scrollDistance += this.distance;
712
- }
713
- this.run();
714
- },
715
- onTouchStart(e) {
716
- this.stop();
717
- let touch = e.touches[0];
718
- if (!touch) {
719
- return;
720
- }
721
- this.touchStartX = touch.clientX;
722
- this.touchStartY = touch.clientY;
723
- this.touchStartDistance = this.scrollDistance;
724
- },
725
- onTouchMove(e) {
726
- e.preventDefault();
727
- if (!this.canScroll) {
728
- return false;
729
- }
730
- let touch = e.touches[0];
731
- if (!touch) {
732
- return false;
733
- }
734
- if (this.isHorizontal) {
735
- this.scrollDistance = this.touchStartDistance + touch.clientX - this.touchStartX;
736
- this.scrollDistance = Math.max(-(this.listWidth - this.bodyWidth), Math.min(0, this.scrollDistance));
737
- } else {
738
- this.scrollDistance = this.touchStartDistance + touch.clientY - this.touchStartY;
739
- this.scrollDistance = Math.max(-(this.listHeight - this.bodyHeight), Math.min(0, this.scrollDistance));
740
- }
741
- },
742
- onTouchEnd() {
743
- this.start();
744
- }
745
- }
746
- });
747
- ;// CONCATENATED MODULE: ./packages/vue-seamless-scroll/index.vue?vue&type=script&lang=js
748
- /* harmony default export */ var packages_vue_seamless_scrollvue_type_script_lang_js = (vue_seamless_scrollvue_type_script_lang_js);
749
- // EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/vue-seamless-scroll/index.vue?vue&type=style&index=0&id=44bde8d8&prod&scoped=true&lang=css
750
- var vue_seamless_scrollvue_type_style_index_0_id_44bde8d8_prod_scoped_true_lang_css = __webpack_require__(179);
751
- ;// CONCATENATED MODULE: ./packages/vue-seamless-scroll/index.vue?vue&type=style&index=0&id=44bde8d8&prod&scoped=true&lang=css
752
-
753
- ;// CONCATENATED MODULE: ./node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js
754
- /* globals __VUE_SSR_CONTEXT__ */
755
-
756
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
757
- // This module is a runtime utility for cleaner component module output and will
758
- // be included in the final webpack user bundle.
759
-
760
- function normalizeComponent(
761
- scriptExports,
762
- render,
763
- staticRenderFns,
764
- functionalTemplate,
765
- injectStyles,
766
- scopeId,
767
- moduleIdentifier /* server only */,
768
- shadowMode /* vue-cli only */
769
- ) {
770
- // Vue.extend constructor export interop
771
- var options =
772
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
773
-
774
- // render functions
775
- if (render) {
776
- options.render = render
777
- options.staticRenderFns = staticRenderFns
778
- options._compiled = true
779
- }
780
-
781
- // functional template
782
- if (functionalTemplate) {
783
- options.functional = true
784
- }
785
-
786
- // scopedId
787
- if (scopeId) {
788
- options._scopeId = 'data-v-' + scopeId
789
- }
790
-
791
- var hook
792
- if (moduleIdentifier) {
793
- // server build
794
- hook = function (context) {
795
- // 2.3 injection
796
- context =
797
- context || // cached call
798
- (this.$vnode && this.$vnode.ssrContext) || // stateful
799
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
800
- // 2.2 with runInNewContext: true
801
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
802
- context = __VUE_SSR_CONTEXT__
803
- }
804
- // inject component styles
805
- if (injectStyles) {
806
- injectStyles.call(this, context)
807
- }
808
- // register component module identifier for async chunk inferrence
809
- if (context && context._registeredComponents) {
810
- context._registeredComponents.add(moduleIdentifier)
811
- }
812
- }
813
- // used by ssr in case component is cached and beforeCreate
814
- // never gets called
815
- options._ssrRegister = hook
816
- } else if (injectStyles) {
817
- hook = shadowMode
818
- ? function () {
819
- injectStyles.call(
820
- this,
821
- (options.functional ? this.parent : this).$root.$options.shadowRoot
822
- )
823
- }
824
- : injectStyles
825
- }
826
-
827
- if (hook) {
828
- if (options.functional) {
829
- // for template-only hot-reload because in that case the render fn doesn't
830
- // go through the normalizer
831
- options._injectStyles = hook
832
- // register for functional component in vue file
833
- var originalRender = options.render
834
- options.render = function renderWithStyleInjection(h, context) {
835
- hook.call(context)
836
- return originalRender(h, context)
837
- }
838
- } else {
839
- // inject component registration as beforeCreate hook
840
- var existing = options.beforeCreate
841
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
842
- }
843
- }
844
-
845
- return {
846
- exports: scriptExports,
847
- options: options
848
- }
849
- }
850
-
851
- ;// CONCATENATED MODULE: ./packages/vue-seamless-scroll/index.vue
852
-
853
-
854
-
855
- ;
856
-
857
-
858
- /* normalize component */
859
-
860
- var component = normalizeComponent(
861
- packages_vue_seamless_scrollvue_type_script_lang_js,
862
- render,
863
- staticRenderFns,
864
- false,
865
- null,
866
- "44bde8d8",
867
- null
868
-
869
- )
870
-
871
- /* harmony default export */ var vue_seamless_scroll = (component.exports);
872
- ;// CONCATENATED MODULE: ./packages/vue-seamless-scroll/index.js
873
-
874
- vue_seamless_scroll.install = function (Vue) {
875
- Vue.component(vue_seamless_scroll.name, vue_seamless_scroll);
876
- };
877
- /* harmony default export */ var packages_vue_seamless_scroll = (vue_seamless_scroll);
878
- ;// CONCATENATED MODULE: ./packages/index.js
879
-
880
- const components = [packages_vue_seamless_scroll];
881
- const install = function (Vue) {
882
- components.forEach(comp => {
883
- Vue.component(comp.name, comp);
884
- });
885
- };
886
- if (typeof window !== 'undefined' && window.Vue) {
887
- install(window.Vue);
888
- }
889
- /* harmony default export */ var packages_0 = ({
890
- install,
891
- VueSeamlessScroll: packages_vue_seamless_scroll
892
- });
893
- ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
894
-
895
-
896
- /* harmony default export */ var entry_lib = (packages_0);
897
-
898
-
899
- }();
900
- module.exports = __webpack_exports__;
901
- /******/ })()
902
- ;
903
- //# sourceMappingURL=vue-seamless-scroll.common.js.map