框架源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

408 lines
11 KiB

4 years ago
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  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. /******/ // define __esModule on exports
  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. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  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. /******/ // getDefaultExport function for compatibility with non-harmony modules
  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. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 544);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 108:
  90. /***/ (function(module, exports) {
  91. module.exports = require("throttle-debounce/throttle");
  92. /***/ }),
  93. /***/ 2:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  97. /* globals __VUE_SSR_CONTEXT__ */
  98. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  99. // This module is a runtime utility for cleaner component module output and will
  100. // be included in the final webpack user bundle.
  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. // Vue.extend constructor export interop
  112. var options = typeof scriptExports === 'function'
  113. ? scriptExports.options
  114. : scriptExports
  115. // render functions
  116. if (render) {
  117. options.render = render
  118. options.staticRenderFns = staticRenderFns
  119. options._compiled = true
  120. }
  121. // functional template
  122. if (functionalTemplate) {
  123. options.functional = true
  124. }
  125. // scopedId
  126. if (scopeId) {
  127. options._scopeId = 'data-v-' + scopeId
  128. }
  129. var hook
  130. if (moduleIdentifier) { // server build
  131. hook = function (context) {
  132. // 2.3 injection
  133. context =
  134. context || // cached call
  135. (this.$vnode && this.$vnode.ssrContext) || // stateful
  136. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  137. // 2.2 with runInNewContext: true
  138. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  139. context = __VUE_SSR_CONTEXT__
  140. }
  141. // inject component styles
  142. if (injectStyles) {
  143. injectStyles.call(this, context)
  144. }
  145. // register component module identifier for async chunk inferrence
  146. if (context && context._registeredComponents) {
  147. context._registeredComponents.add(moduleIdentifier)
  148. }
  149. }
  150. // used by ssr in case component is cached and beforeCreate
  151. // never gets called
  152. options._ssrRegister = hook
  153. } else if (injectStyles) {
  154. hook = shadowMode
  155. ? function () {
  156. injectStyles.call(
  157. this,
  158. (options.functional ? this.parent : this).$root.$options.shadowRoot
  159. )
  160. }
  161. : injectStyles
  162. }
  163. if (hook) {
  164. if (options.functional) {
  165. // for template-only hot-reload because in that case the render fn doesn't
  166. // go through the normalizer
  167. options._injectStyles = hook
  168. // register for functional component in vue file
  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. // inject component registration as beforeCreate hook
  176. var existing = options.beforeCreate
  177. options.beforeCreate = existing
  178. ? [].concat(existing, hook)
  179. : [hook]
  180. }
  181. }
  182. return {
  183. exports: scriptExports,
  184. options: options
  185. }
  186. }
  187. /***/ }),
  188. /***/ 544:
  189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  190. "use strict";
  191. // ESM COMPAT FLAG
  192. __webpack_require__.r(__webpack_exports__);
  193. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/backtop/src/main.vue?vue&type=template&id=257dd4a9&
  194. var render = function() {
  195. var _vm = this
  196. var _h = _vm.$createElement
  197. var _c = _vm._self._c || _h
  198. return _c("transition", { attrs: { name: "el-fade-in" } }, [
  199. _vm.visible
  200. ? _c(
  201. "div",
  202. {
  203. staticClass: "el-backtop",
  204. style: {
  205. right: _vm.styleRight,
  206. bottom: _vm.styleBottom
  207. },
  208. on: {
  209. click: function($event) {
  210. $event.stopPropagation()
  211. return _vm.handleClick($event)
  212. }
  213. }
  214. },
  215. [
  216. _vm._t("default", [
  217. _c("tis-icon", { attrs: { name: "caret-top" } })
  218. ])
  219. ],
  220. 2
  221. )
  222. : _vm._e()
  223. ])
  224. }
  225. var staticRenderFns = []
  226. render._withStripped = true
  227. // CONCATENATED MODULE: ./packages/backtop/src/main.vue?vue&type=template&id=257dd4a9&
  228. // EXTERNAL MODULE: external "throttle-debounce/throttle"
  229. var throttle_ = __webpack_require__(108);
  230. var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle_);
  231. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/backtop/src/main.vue?vue&type=script&lang=js&
  232. //
  233. //
  234. //
  235. //
  236. //
  237. //
  238. //
  239. //
  240. //
  241. //
  242. //
  243. //
  244. //
  245. //
  246. //
  247. //
  248. //
  249. var cubic = function cubic(value) {
  250. return Math.pow(value, 3);
  251. };
  252. var easeInOutCubic = function easeInOutCubic(value) {
  253. return value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
  254. };
  255. /* harmony default export */ var mainvue_type_script_lang_js_ = ({
  256. name: 'TisBacktop',
  257. props: {
  258. visibilityHeight: {
  259. type: Number,
  260. default: 200
  261. },
  262. target: [String],
  263. right: {
  264. type: Number,
  265. default: 40
  266. },
  267. bottom: {
  268. type: Number,
  269. default: 40
  270. }
  271. },
  272. data: function data() {
  273. return {
  274. el: null,
  275. container: null,
  276. visible: false
  277. };
  278. },
  279. computed: {
  280. styleBottom: function styleBottom() {
  281. return this.bottom + 'px';
  282. },
  283. styleRight: function styleRight() {
  284. return this.right + 'px';
  285. }
  286. },
  287. mounted: function mounted() {
  288. this.init();
  289. this.throttledScrollHandler = throttle_default()(300, this.onScroll);
  290. this.container.addEventListener('scroll', this.throttledScrollHandler);
  291. },
  292. methods: {
  293. init: function init() {
  294. this.container = document;
  295. this.el = document.documentElement;
  296. if (this.target) {
  297. this.el = document.querySelector(this.target);
  298. if (!this.el) {
  299. throw new Error('target is not existed: ' + this.target);
  300. }
  301. this.container = this.el;
  302. }
  303. },
  304. onScroll: function onScroll() {
  305. var scrollTop = this.el.scrollTop;
  306. this.visible = scrollTop >= this.visibilityHeight;
  307. },
  308. handleClick: function handleClick(e) {
  309. this.scrollToTop();
  310. this.$emit('click', e);
  311. },
  312. scrollToTop: function scrollToTop() {
  313. var el = this.el;
  314. var beginTime = Date.now();
  315. var beginValue = el.scrollTop;
  316. var rAF = window.requestAnimationFrame || function (func) {
  317. return setTimeout(func, 16);
  318. };
  319. var frameFunc = function frameFunc() {
  320. var progress = (Date.now() - beginTime) / 500;
  321. if (progress < 1) {
  322. el.scrollTop = beginValue * (1 - easeInOutCubic(progress));
  323. rAF(frameFunc);
  324. } else {
  325. el.scrollTop = 0;
  326. }
  327. };
  328. rAF(frameFunc);
  329. }
  330. },
  331. beforeDestroy: function beforeDestroy() {
  332. this.container.removeEventListener('scroll', this.throttledScrollHandler);
  333. }
  334. });
  335. // CONCATENATED MODULE: ./packages/backtop/src/main.vue?vue&type=script&lang=js&
  336. /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
  337. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  338. var componentNormalizer = __webpack_require__(2);
  339. // CONCATENATED MODULE: ./packages/backtop/src/main.vue
  340. /* normalize component */
  341. var component = Object(componentNormalizer["a" /* default */])(
  342. src_mainvue_type_script_lang_js_,
  343. render,
  344. staticRenderFns,
  345. false,
  346. null,
  347. null,
  348. null
  349. )
  350. /* hot reload */
  351. if (false) { var api; }
  352. component.options.__file = "packages/backtop/src/main.vue"
  353. /* harmony default export */ var main = (component.exports);
  354. // CONCATENATED MODULE: ./packages/backtop/index.js
  355. /* istanbul ignore next */
  356. main.install = function (Vue) {
  357. Vue.component(main.name, main);
  358. };
  359. /* harmony default export */ var backtop = __webpack_exports__["default"] = (main);
  360. /***/ })
  361. /******/ });