| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647 |
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId])
- /******/ return installedModules[moduleId].exports;
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/ // identity function for calling harmony imports with the correct context
- /******/ __webpack_require__.i = function(value) { return value; };
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 238);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ function(module, exports) {
- /* globals __VUE_SSR_CONTEXT__ */
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
- var hook
- if (moduleIdentifier) { // server build
- hook = function (context) {
- // 2.3 injection
- context =
- context || // cached call
- (this.$vnode && this.$vnode.ssrContext) || // stateful
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
- // 2.2 with runInNewContext: true
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
- context = __VUE_SSR_CONTEXT__
- }
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
- }
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
- }
- }
- // used by ssr in case component is cached and beforeCreate
- // never gets called
- options._ssrRegister = hook
- } else if (injectStyles) {
- hook = injectStyles
- }
- if (hook) {
- var functional = options.functional
- var existing = functional
- ? options.render
- : options.beforeCreate
- if (!functional) {
- // inject component registration as beforeCreate hook
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- } else {
- // register for functioal component in vue file
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return existing(h, context)
- }
- }
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ },
- /***/ 1:
- /***/ function(module, exports) {
- module.exports = require("vue");
- /***/ },
- /***/ 105:
- /***/ function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ },
- /***/ 161:
- /***/ function(module, exports, __webpack_require__) {
- function injectStyle (ssrContext) {
- __webpack_require__(105)
- }
- var Component = __webpack_require__(0)(
- /* script */
- __webpack_require__(83),
- /* template */
- __webpack_require__(174),
- /* styles */
- injectStyle,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
- module.exports = Component.exports
- /***/ },
- /***/ 174:
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('div', {
- staticClass: "mint-tab-container",
- on: {
- "touchstart": _vm.startDrag,
- "mousedown": _vm.startDrag,
- "touchmove": _vm.onDrag,
- "mousemove": _vm.onDrag,
- "mouseup": _vm.endDrag,
- "touchend": _vm.endDrag
- }
- }, [_c('div', {
- ref: "wrap",
- staticClass: "mint-tab-container-wrap"
- }, [_vm._t("default")], 2)])
- },staticRenderFns: []}
- /***/ },
- /***/ 2:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
- /* unused harmony export on */
- /* unused harmony export off */
- /* harmony export (binding) */ __webpack_require__.d(exports, "c", function() { return once; });
- /* unused harmony export hasClass */
- /* harmony export (immutable) */ exports["a"] = addClass;
- /* harmony export (immutable) */ exports["b"] = removeClass;
- /* unused harmony export getStyle */
- /* unused harmony export setStyle */
- /* istanbul ignore next */
- var isServer = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer;
- var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
- var MOZ_HACK_REGEXP = /^moz([A-Z])/;
- var ieVersion = isServer ? 0 : Number(document.documentMode);
- /* istanbul ignore next */
- var trim = function(string) {
- return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
- };
- /* istanbul ignore next */
- var camelCase = function(name) {
- return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
- return offset ? letter.toUpperCase() : letter;
- }).replace(MOZ_HACK_REGEXP, 'Moz$1');
- };
- /* istanbul ignore next */
- var on = (function() {
- if (!isServer && document.addEventListener) {
- return function(element, event, handler) {
- if (element && event && handler) {
- element.addEventListener(event, handler, false);
- }
- };
- } else {
- return function(element, event, handler) {
- if (element && event && handler) {
- element.attachEvent('on' + event, handler);
- }
- };
- }
- })();
- /* istanbul ignore next */
- var off = (function() {
- if (!isServer && document.removeEventListener) {
- return function(element, event, handler) {
- if (element && event) {
- element.removeEventListener(event, handler, false);
- }
- };
- } else {
- return function(element, event, handler) {
- if (element && event) {
- element.detachEvent('on' + event, handler);
- }
- };
- }
- })();
- /* istanbul ignore next */
- var once = function(el, event, fn) {
- var listener = function() {
- if (fn) {
- fn.apply(this, arguments);
- }
- off(el, event, listener);
- };
- on(el, event, listener);
- };
- /* istanbul ignore next */
- function hasClass(el, cls) {
- if (!el || !cls) return false;
- if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
- if (el.classList) {
- return el.classList.contains(cls);
- } else {
- return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
- }
- };
- /* istanbul ignore next */
- function addClass(el, cls) {
- if (!el) return;
- var curClass = el.className;
- var classes = (cls || '').split(' ');
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
- if (el.classList) {
- el.classList.add(clsName);
- } else {
- if (!hasClass(el, clsName)) {
- curClass += ' ' + clsName;
- }
- }
- }
- if (!el.classList) {
- el.className = curClass;
- }
- };
- /* istanbul ignore next */
- function removeClass(el, cls) {
- if (!el || !cls) return;
- var classes = cls.split(' ');
- var curClass = ' ' + el.className + ' ';
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
- if (el.classList) {
- el.classList.remove(clsName);
- } else {
- if (hasClass(el, clsName)) {
- curClass = curClass.replace(' ' + clsName + ' ', ' ');
- }
- }
- }
- if (!el.classList) {
- el.className = trim(curClass);
- }
- };
- /* istanbul ignore next */
- var getStyle = ieVersion < 9 ? function(element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'styleFloat';
- }
- try {
- switch (styleName) {
- case 'opacity':
- try {
- return element.filters.item('alpha').opacity / 100;
- } catch (e) {
- return 1.0;
- }
- default:
- return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
- }
- } catch (e) {
- return element.style[styleName];
- }
- } : function(element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'cssFloat';
- }
- try {
- var computed = document.defaultView.getComputedStyle(element, '');
- return element.style[styleName] || computed ? computed[styleName] : null;
- } catch (e) {
- return element.style[styleName];
- }
- };
- /* istanbul ignore next */
- function setStyle(element, styleName, value) {
- if (!element || !styleName) return;
- if (typeof styleName === 'object') {
- for (var prop in styleName) {
- if (styleName.hasOwnProperty(prop)) {
- setStyle(element, prop, styleName[prop]);
- }
- }
- } else {
- styleName = camelCase(styleName);
- if (styleName === 'opacity' && ieVersion < 9) {
- element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
- } else {
- element.style[styleName] = value;
- }
- }
- };
- /***/ },
- /***/ 200:
- /***/ function(module, exports) {
- module.exports = require("array-find-index");
- /***/ },
- /***/ 238:
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(47);
- /***/ },
- /***/ 47:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_tab_container_vue__ = __webpack_require__(161);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_tab_container_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_tab_container_vue__);
- Object.defineProperty(exports, "__esModule", { value: true });
- /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_tab_container_vue___default.a; });
- /***/ },
- /***/ 83:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_dom__ = __webpack_require__(2);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_array_find_index__ = __webpack_require__(200);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_array_find_index___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_array_find_index__);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /**
- * mt-tab-container
- * @desc 面板,搭配 tab-container-item 使用
- * @module components/tab-container
- *
- * @param {number|string} [value] - 当前激活的 tabId
- *
- * @example
- * <mt-tab-container v-model="selected">
- * <mt-tab-container-item id="1"> 内容A </mt-tab-container-item>
- * <mt-tab-container-item id="2"> 内容B </mt-tab-container-item>
- * <mt-tab-container-item id="3"> 内容C </mt-tab-container-item>
- * </mt-tab-container>
- */
- /* harmony default export */ exports["default"] = {
- name: 'mt-tab-container',
- props: {
- value: {},
- swipeable: Boolean
- },
- data: function data() {
- return {
- start: { x: 0, y: 0 },
- swiping: false,
- activeItems: [],
- pageWidth: 0,
- currentActive: this.value
- };
- },
- watch: {
- value: function value(val) {
- this.currentActive = val;
- },
- currentActive: function currentActive(val, oldValue) {
- this.$emit('input', val);
- if (!this.swipeable) return;
- var lastIndex = __WEBPACK_IMPORTED_MODULE_1_array_find_index___default()(this.$children,
- function (item) { return item.id === oldValue; });
- this.swipeLeaveTransition(lastIndex);
- }
- },
- mounted: function mounted() {
- if (!this.swipeable) return;
- this.wrap = this.$refs.wrap;
- this.pageWidth = this.wrap.clientWidth;
- this.limitWidth = this.pageWidth / 4;
- },
- methods: {
- swipeLeaveTransition: function swipeLeaveTransition(lastIndex) {
- var this$1 = this;
- if ( lastIndex === void 0 ) lastIndex = 0;
- if (typeof this.index !== 'number') {
- this.index = __WEBPACK_IMPORTED_MODULE_1_array_find_index___default()(this.$children,
- function (item) { return item.id === this$1.currentActive; });
- this.swipeMove(-lastIndex * this.pageWidth);
- }
- setTimeout(function () {
- this$1.wrap.classList.add('swipe-transition');
- this$1.swipeMove(-this$1.index * this$1.pageWidth);
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_dom__["c" /* once */])(this$1.wrap, 'webkitTransitionEnd', function (_) {
- this$1.wrap.classList.remove('swipe-transition');
- this$1.wrap.style.webkitTransform = '';
- this$1.swiping = false;
- this$1.index = null;
- });
- }, 0);
- },
- swipeMove: function swipeMove(offset) {
- this.wrap.style.webkitTransform = "translate3d(" + offset + "px, 0, 0)";
- this.swiping = true;
- },
- startDrag: function startDrag(evt) {
- if (!this.swipeable) return;
- evt = evt.changedTouches ? evt.changedTouches[0] : evt;
- this.dragging = true;
- this.start.x = evt.pageX;
- this.start.y = evt.pageY;
- },
- onDrag: function onDrag(evt) {
- var this$1 = this;
- if (!this.dragging) return;
- var swiping;
- var e = evt.changedTouches ? evt.changedTouches[0] : evt;
- var offsetTop = e.pageY - this.start.y;
- var offsetLeft = e.pageX - this.start.x;
- var y = Math.abs(offsetTop);
- var x = Math.abs(offsetLeft);
- swiping = !(x < 5 || (x >= 5 && y >= x * 1.73));
- if (!swiping) return;
- evt.preventDefault();
- var len = this.$children.length - 1;
- var index = __WEBPACK_IMPORTED_MODULE_1_array_find_index___default()(this.$children,
- function (item) { return item.id === this$1.currentActive; });
- var currentPageOffset = index * this.pageWidth;
- var offset = offsetLeft - currentPageOffset;
- var absOffset = Math.abs(offset);
- if (absOffset > len * this.pageWidth ||
- (offset > 0 && offset < this.pageWidth)) {
- this.swiping = false;
- return;
- }
- this.offsetLeft = offsetLeft;
- this.index = index;
- this.swipeMove(offset);
- },
- endDrag: function endDrag() {
- if (!this.swiping) return;
- this.dragging = false;
- var direction = this.offsetLeft > 0 ? -1 : 1;
- var isChange = Math.abs(this.offsetLeft) > this.limitWidth;
- if (isChange) {
- this.index += direction;
- var child = this.$children[this.index];
- if (child) {
- this.currentActive = child.id;
- return;
- }
- }
- this.swipeLeaveTransition();
- }
- }
- };
- /***/ }
- /******/ });
|