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 = 108);
|
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 | 108:
|
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("transition", { attrs: { name: "el-fade-in" } }, [
|
204 | _vm.visible
|
205 | ? _c(
|
206 | "div",
|
207 | {
|
208 | staticClass: "el-backtop",
|
209 | style: {
|
210 | right: _vm.styleRight,
|
211 | bottom: _vm.styleBottom
|
212 | },
|
213 | on: {
|
214 | click: function($event) {
|
215 | $event.stopPropagation()
|
216 | return _vm.handleClick($event)
|
217 | }
|
218 | }
|
219 | },
|
220 | [
|
221 | _vm._t("default", [_c("el-icon", { attrs: { name: "caret-top" } })])
|
222 | ],
|
223 | 2
|
224 | )
|
225 | : _vm._e()
|
226 | ])
|
227 | }
|
228 | var staticRenderFns = []
|
229 | render._withStripped = true
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 | var throttle_ = __webpack_require__(25);
|
236 | var throttle_default = __webpack_require__.n(throttle_);
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 | var cubic = function cubic(value) {
|
260 | return Math.pow(value, 3);
|
261 | };
|
262 | var easeInOutCubic = function easeInOutCubic(value) {
|
263 | return value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
264 | };
|
265 |
|
266 | var mainvue_type_script_lang_js_ = ({
|
267 | name: 'ElBacktop',
|
268 |
|
269 | props: {
|
270 | visibilityHeight: {
|
271 | type: Number,
|
272 | default: 200
|
273 | },
|
274 | target: [String],
|
275 | right: {
|
276 | type: Number,
|
277 | default: 40
|
278 | },
|
279 | bottom: {
|
280 | type: Number,
|
281 | default: 40
|
282 | }
|
283 | },
|
284 |
|
285 | data: function data() {
|
286 | return {
|
287 | el: null,
|
288 | container: null,
|
289 | visible: false
|
290 | };
|
291 | },
|
292 |
|
293 |
|
294 | computed: {
|
295 | styleBottom: function styleBottom() {
|
296 | return this.bottom + 'px';
|
297 | },
|
298 | styleRight: function styleRight() {
|
299 | return this.right + 'px';
|
300 | }
|
301 | },
|
302 |
|
303 | mounted: function mounted() {
|
304 | this.init();
|
305 | this.throttledScrollHandler = throttle_default()(300, this.onScroll);
|
306 | this.container.addEventListener('scroll', this.throttledScrollHandler);
|
307 | },
|
308 |
|
309 |
|
310 | methods: {
|
311 | init: function init() {
|
312 | this.container = document;
|
313 | this.el = document.documentElement;
|
314 | if (this.target) {
|
315 | this.el = document.querySelector(this.target);
|
316 | if (!this.el) {
|
317 | throw new Error('target is not existed: ' + this.target);
|
318 | }
|
319 | this.container = this.el;
|
320 | }
|
321 | },
|
322 | onScroll: function onScroll() {
|
323 | var scrollTop = this.el.scrollTop;
|
324 | this.visible = scrollTop >= this.visibilityHeight;
|
325 | },
|
326 | handleClick: function handleClick(e) {
|
327 | this.scrollToTop();
|
328 | this.$emit('click', e);
|
329 | },
|
330 | scrollToTop: function scrollToTop() {
|
331 | var el = this.el;
|
332 | var beginTime = Date.now();
|
333 | var beginValue = el.scrollTop;
|
334 | var rAF = window.requestAnimationFrame || function (func) {
|
335 | return setTimeout(func, 16);
|
336 | };
|
337 | var frameFunc = function frameFunc() {
|
338 | var progress = (Date.now() - beginTime) / 500;
|
339 | if (progress < 1) {
|
340 | el.scrollTop = beginValue * (1 - easeInOutCubic(progress));
|
341 | rAF(frameFunc);
|
342 | } else {
|
343 | el.scrollTop = 0;
|
344 | }
|
345 | };
|
346 | rAF(frameFunc);
|
347 | }
|
348 | },
|
349 |
|
350 | beforeDestroy: function beforeDestroy() {
|
351 | this.container.removeEventListener('scroll', this.throttledScrollHandler);
|
352 | }
|
353 | });
|
354 |
|
355 | var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
|
356 |
|
357 | var componentNormalizer = __webpack_require__(0);
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 | var component = Object(componentNormalizer["a" ])(
|
368 | src_mainvue_type_script_lang_js_,
|
369 | render,
|
370 | staticRenderFns,
|
371 | false,
|
372 | null,
|
373 | null,
|
374 | null
|
375 |
|
376 | )
|
377 |
|
378 |
|
379 | if (false) { var api; }
|
380 | component.options.__file = "packages/backtop/src/main.vue"
|
381 | var main = (component.exports);
|
382 |
|
383 |
|
384 |
|
385 |
|
386 | main.install = function (Vue) {
|
387 | Vue.component(main.name, main);
|
388 | };
|
389 |
|
390 | var backtop = __webpack_exports__["default"] = (main);
|
391 |
|
392 | }),
|
393 |
|
394 | 25:
|
395 | (function(module, exports) {
|
396 |
|
397 | module.exports = require("throttle-debounce/throttle");
|
398 |
|
399 | })
|
400 |
|
401 | }); |
\ | No newline at end of file |