vant-fork
Version:
Lightweight Mobile UI Components built on Vue
1,228 lines (1,071 loc) • 276 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
else if(typeof define === 'function' && define.amd)
define("vant", ["vue"], factory);
else if(typeof exports === 'object')
exports["vant"] = factory(require("vue"));
else
root["vant"] = factory(root["Vue"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE__1__) {
return /******/ (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;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // 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 = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return get; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return range; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isObj; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isServer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return camelize; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isAndroid; });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
var isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer;
function isDef(value) {
return value !== undefined && value !== null;
}
function isObj(x) {
var type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
function get(object, path) {
var keys = path.split('.');
var result = object;
keys.forEach(function (key) {
result = isDef(result[key]) ? result[key] : '';
});
return result;
}
var camelizeRE = /-(\w)/g;
function camelize(str) {
return str.replace(camelizeRE, function (_, c) {
return c.toUpperCase();
});
}
function isAndroid() {
/* istanbul ignore next */
return isServer ? false : /android/.test(navigator.userAgent.toLowerCase());
}
function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
;
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return raf; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cancel; });
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/**
* requestAnimationFrame polyfill
*/
var prev = Date.now();
/* istanbul ignore next */
function fallback(fn) {
var curr = Date.now();
var ms = Math.max(0, 16 - (curr - prev));
var id = setTimeout(fn, ms);
prev = curr + ms;
return id;
}
/* istanbul ignore next */
var root = _index__WEBPACK_IMPORTED_MODULE_0__[/* isServer */ "f"] ? global : window;
/* istanbul ignore next */
var iRaf = root.requestAnimationFrame || root.webkitRequestAnimationFrame || fallback;
/* istanbul ignore next */
var iCancel = root.cancelAnimationFrame || root.webkitCancelAnimationFrame || root.clearTimeout;
function raf(fn) {
return iRaf.call(root, fn);
}
function cancel(id) {
iCancel.call(root, id);
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(4)))
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
/*!
* Vue-Lazyload.js v1.2.3
* (c) 2018 Awe <hilongjw@gmail.com>
* Released under the MIT License.
*/
!function(e,t){ true?module.exports=t():undefined}(this,function(){"use strict";function e(e){return e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function t(e){e=e||{};var t=arguments.length,i=0;if(1===t)return e;for(;++i<t;){var o=arguments[i];g(e)&&(e=o),r(o)&&n(e,o)}return e}function n(e,n){m(e,n);for(var o in n)if("__proto__"!==o&&i(n,o)){var a=n[o];r(a)?("undefined"===L(e[o])&&"function"===L(a)&&(e[o]=a),e[o]=t(e[o]||{},a)):e[o]=a}return e}function r(e){return"object"===L(e)||"function"===L(e)}function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e,t){if(e.length){var n=e.indexOf(t);return n>-1?e.splice(n,1):void 0}}function a(e,t){for(var n=!1,r=0,i=e.length;r<i;r++)if(t(e[r])){n=!0;break}return n}function s(e,t){if("IMG"===e.tagName&&e.getAttribute("data-srcset")){var n=e.getAttribute("data-srcset"),r=[],i=e.parentNode,o=i.offsetWidth*t,a=void 0,s=void 0,u=void 0;n=n.trim().split(","),n.map(function(e){e=e.trim(),a=e.lastIndexOf(" "),-1===a?(s=e,u=999998):(s=e.substr(0,a),u=parseInt(e.substr(a+1,e.length-a-2),10)),r.push([u,s])}),r.sort(function(e,t){if(e[0]<t[0])return-1;if(e[0]>t[0])return 1;if(e[0]===t[0]){if(-1!==t[1].indexOf(".webp",t[1].length-5))return 1;if(-1!==e[1].indexOf(".webp",e[1].length-5))return-1}return 0});for(var l="",d=void 0,c=r.length,h=0;h<c;h++)if(d=r[h],d[0]>=o){l=d[1];break}return l}}function u(e,t){for(var n=void 0,r=0,i=e.length;r<i;r++)if(t(e[r])){n=e[r];break}return n}function l(){if(!k)return!1;var e=!0,t=document;try{var n=t.createElement("object");n.type="image/webp",n.style.visibility="hidden",n.innerHTML="!",t.body.appendChild(n),e=!n.offsetWidth,t.body.removeChild(n)}catch(t){e=!1}return e}function d(e,t){var n=null,r=0;return function(){if(!n){var i=Date.now()-r,o=this,a=arguments,s=function(){r=Date.now(),n=!1,e.apply(o,a)};i>=t?s():n=setTimeout(s,t)}}}function c(e){return null!==e&&"object"===(void 0===e?"undefined":p(e))}function h(e){if(!(e instanceof Object))return[];if(Object.keys)return Object.keys(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}function f(e){for(var t=e.length,n=[],r=0;r<t;r++)n.push(e[r]);return n}function v(){}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},y=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),g=function(e){return null==e||"function"!=typeof e&&"object"!==(void 0===e?"undefined":p(e))},m=function(e,t){if(null===e||void 0===e)throw new TypeError("expected first argument to be an object.");if(void 0===t||"undefined"==typeof Symbol)return e;if("function"!=typeof Object.getOwnPropertySymbols)return e;for(var n=Object.prototype.propertyIsEnumerable,r=Object(e),i=arguments.length,o=0;++o<i;)for(var a=Object(arguments[o]),s=Object.getOwnPropertySymbols(a),u=0;u<s.length;u++){var l=s[u];n.call(a,l)&&(r[l]=a[l])}return r},w=Object.prototype.toString,L=function(t){var n=void 0===t?"undefined":p(t);return"undefined"===n?"undefined":null===t?"null":!0===t||!1===t||t instanceof Boolean?"boolean":"string"===n||t instanceof String?"string":"number"===n||t instanceof Number?"number":"function"===n||t instanceof Function?void 0!==t.constructor.name&&"Generator"===t.constructor.name.slice(0,9)?"generatorfunction":"function":void 0!==Array.isArray&&Array.isArray(t)?"array":t instanceof RegExp?"regexp":t instanceof Date?"date":(n=w.call(t),"[object RegExp]"===n?"regexp":"[object Date]"===n?"date":"[object Arguments]"===n?"arguments":"[object Error]"===n?"error":"[object Promise]"===n?"promise":e(t)?"buffer":"[object Set]"===n?"set":"[object WeakSet]"===n?"weakset":"[object Map]"===n?"map":"[object WeakMap]"===n?"weakmap":"[object Symbol]"===n?"symbol":"[object Map Iterator]"===n?"mapiterator":"[object Set Iterator]"===n?"setiterator":"[object String Iterator]"===n?"stringiterator":"[object Array Iterator]"===n?"arrayiterator":"[object Int8Array]"===n?"int8array":"[object Uint8Array]"===n?"uint8array":"[object Uint8ClampedArray]"===n?"uint8clampedarray":"[object Int16Array]"===n?"int16array":"[object Uint16Array]"===n?"uint16array":"[object Int32Array]"===n?"int32array":"[object Uint32Array]"===n?"uint32array":"[object Float32Array]"===n?"float32array":"[object Float64Array]"===n?"float64array":"object")},_=t,k="undefined"!=typeof window,E=k&&"IntersectionObserver"in window,A={event:"event",observer:"observer"},j=function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}if(k)return"function"==typeof window.CustomEvent?window.CustomEvent:(e.prototype=window.Event.prototype,e)}(),z=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return k?window.devicePixelRatio||e:e},T=function(){if(k){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t)}catch(e){}return e}}(),O={on:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];T?e.addEventListener(t,n,{capture:r,passive:!0}):e.addEventListener(t,n,r)},off:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.removeEventListener(t,n,r)}},I=function(e,t,n){var r=new Image;r.src=e.src,r.onload=function(){t({naturalHeight:r.naturalHeight,naturalWidth:r.naturalWidth,src:r.src})},r.onerror=function(e){n(e)}},x=function(e,t){return"undefined"!=typeof getComputedStyle?getComputedStyle(e,null).getPropertyValue(t):e.style[t]},S=function(e){return x(e,"overflow")+x(e,"overflow-y")+x(e,"overflow-x")},$=function(e){if(k){if(!(e instanceof HTMLElement))return window;for(var t=e;t&&t!==document.body&&t!==document.documentElement&&t.parentNode;){if(/(scroll|auto)/.test(S(t)))return t;t=t.parentNode}return window}},H={},Q=function(){function e(t){var n=t.el,r=t.src,i=t.error,o=t.loading,a=t.bindType,s=t.$parent,u=t.options,l=t.elRenderer;b(this,e),this.el=n,this.src=r,this.error=i,this.loading=o,this.bindType=a,this.attempt=0,this.naturalHeight=0,this.naturalWidth=0,this.options=u,this.rect=null,this.$parent=s,this.elRenderer=l,this.performanceData={init:Date.now(),loadStart:0,loadEnd:0},this.filter(),this.initState(),this.render("loading",!1)}return y(e,[{key:"initState",value:function(){this.el.dataset.src=this.src,this.state={error:!1,loaded:!1,rendered:!1}}},{key:"record",value:function(e){this.performanceData[e]=Date.now()}},{key:"update",value:function(e){var t=e.src,n=e.loading,r=e.error,i=this.src;this.src=t,this.loading=n,this.error=r,this.filter(),i!==this.src&&(this.attempt=0,this.initState())}},{key:"getRect",value:function(){this.rect=this.el.getBoundingClientRect()}},{key:"checkInView",value:function(){return this.getRect(),this.rect.top<window.innerHeight*this.options.preLoad&&this.rect.bottom>this.options.preLoadTop&&this.rect.left<window.innerWidth*this.options.preLoad&&this.rect.right>0}},{key:"filter",value:function(){var e=this;h(this.options.filter).map(function(t){e.options.filter[t](e,e.options)})}},{key:"renderLoading",value:function(e){var t=this;I({src:this.loading},function(n){t.render("loading",!1),e()},function(){e(),t.options.silent||console.warn("VueLazyload log: load failed with loading image("+t.loading+")")})}},{key:"load",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;return this.attempt>this.options.attempt-1&&this.state.error?(this.options.silent||console.log("VueLazyload log: "+this.src+" tried too more than "+this.options.attempt+" times"),void t()):this.state.loaded||H[this.src]?(this.state.loaded=!0,t(),this.render("loaded",!0)):void this.renderLoading(function(){e.attempt++,e.record("loadStart"),I({src:e.src},function(n){e.naturalHeight=n.naturalHeight,e.naturalWidth=n.naturalWidth,e.state.loaded=!0,e.state.error=!1,e.record("loadEnd"),e.render("loaded",!1),H[e.src]=1,t()},function(t){!e.options.silent&&console.error(t),e.state.error=!0,e.state.loaded=!1,e.render("error",!1)})})}},{key:"render",value:function(e,t){this.elRenderer(this,e,t)}},{key:"performance",value:function(){var e="loading",t=0;return this.state.loaded&&(e="loaded",t=(this.performanceData.loadEnd-this.performanceData.loadStart)/1e3),this.state.error&&(e="error"),{src:this.src,state:e,time:t}}},{key:"destroy",value:function(){this.el=null,this.src=null,this.error=null,this.loading=null,this.bindType=null,this.attempt=0}}]),e}(),C="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",R=["scroll","wheel","mousewheel","resize","animationend","transitionend","touchmove"],W={rootMargin:"0px",threshold:0},D=function(e){return function(){function t(e){var n=e.preLoad,r=e.error,i=e.throttleWait,o=e.preLoadTop,a=e.dispatchEvent,s=e.loading,u=e.attempt,c=e.silent,h=void 0===c||c,f=e.scale,v=e.listenEvents,p=(e.hasbind,e.filter),y=e.adapter,g=e.observer,m=e.observerOptions;b(this,t),this.version="1.2.3",this.mode=A.event,this.ListenerQueue=[],this.TargetIndex=0,this.TargetQueue=[],this.options={silent:h,dispatchEvent:!!a,throttleWait:i||200,preLoad:n||1.3,preLoadTop:o||0,error:r||C,loading:s||C,attempt:u||3,scale:f||z(f),ListenEvents:v||R,hasbind:!1,supportWebp:l(),filter:p||{},adapter:y||{},observer:!!g,observerOptions:m||W},this._initEvent(),this.lazyLoadHandler=d(this._lazyLoadHandler.bind(this),this.options.throttleWait),this.setMode(this.options.observer?A.observer:A.event)}return y(t,[{key:"config",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};_(this.options,e)}},{key:"performance",value:function(){var e=[];return this.ListenerQueue.map(function(t){e.push(t.performance())}),e}},{key:"addLazyBox",value:function(e){this.ListenerQueue.push(e),k&&(this._addListenerTarget(window),this._observer&&this._observer.observe(e.el),e.$el&&e.$el.parentNode&&this._addListenerTarget(e.$el.parentNode))}},{key:"add",value:function(t,n,r){var i=this;if(a(this.ListenerQueue,function(e){return e.el===t}))return this.update(t,n),e.nextTick(this.lazyLoadHandler);var o=this._valueFormatter(n.value),u=o.src,l=o.loading,d=o.error;e.nextTick(function(){u=s(t,i.options.scale)||u,i._observer&&i._observer.observe(t);var o=Object.keys(n.modifiers)[0],a=void 0;o&&(a=r.context.$refs[o],a=a?a.$el||a:document.getElementById(o)),a||(a=$(t));var c=new Q({bindType:n.arg,$parent:a,el:t,loading:l,error:d,src:u,elRenderer:i._elRenderer.bind(i),options:i.options});i.ListenerQueue.push(c),k&&(i._addListenerTarget(window),i._addListenerTarget(a)),i.lazyLoadHandler(),e.nextTick(function(){return i.lazyLoadHandler()})})}},{key:"update",value:function(t,n){var r=this,i=this._valueFormatter(n.value),o=i.src,a=i.loading,l=i.error;o=s(t,this.options.scale)||o;var d=u(this.ListenerQueue,function(e){return e.el===t});d&&d.update({src:o,loading:a,error:l}),this._observer&&(this._observer.unobserve(t),this._observer.observe(t)),this.lazyLoadHandler(),e.nextTick(function(){return r.lazyLoadHandler()})}},{key:"remove",value:function(e){if(e){this._observer&&this._observer.unobserve(e);var t=u(this.ListenerQueue,function(t){return t.el===e});t&&(this._removeListenerTarget(t.$parent),this._removeListenerTarget(window),o(this.ListenerQueue,t)&&t.destroy())}}},{key:"removeComponent",value:function(e){e&&(o(this.ListenerQueue,e),this._observer&&this._observer.unobserve(e.el),e.$parent&&e.$el.parentNode&&this._removeListenerTarget(e.$el.parentNode),this._removeListenerTarget(window))}},{key:"setMode",value:function(e){var t=this;E||e!==A.observer||(e=A.event),this.mode=e,e===A.event?(this._observer&&(this.ListenerQueue.forEach(function(e){t._observer.unobserve(e.el)}),this._observer=null),this.TargetQueue.forEach(function(e){t._initListen(e.el,!0)})):(this.TargetQueue.forEach(function(e){t._initListen(e.el,!1)}),this._initIntersectionObserver())}},{key:"_addListenerTarget",value:function(e){if(e){var t=u(this.TargetQueue,function(t){return t.el===e});return t?t.childrenCount++:(t={el:e,id:++this.TargetIndex,childrenCount:1,listened:!0},this.mode===A.event&&this._initListen(t.el,!0),this.TargetQueue.push(t)),this.TargetIndex}}},{key:"_removeListenerTarget",value:function(e){var t=this;this.TargetQueue.forEach(function(n,r){n.el===e&&(--n.childrenCount||(t._initListen(n.el,!1),t.TargetQueue.splice(r,1),n=null))})}},{key:"_initListen",value:function(e,t){var n=this;this.options.ListenEvents.forEach(function(r){return O[t?"on":"off"](e,r,n.lazyLoadHandler)})}},{key:"_initEvent",value:function(){var e=this;this.Event={listeners:{loading:[],loaded:[],error:[]}},this.$on=function(t,n){e.Event.listeners[t].push(n)},this.$once=function(t,n){function r(){i.$off(t,r),n.apply(i,arguments)}var i=e;e.$on(t,r)},this.$off=function(t,n){if(!n)return void(e.Event.listeners[t]=[]);o(e.Event.listeners[t],n)},this.$emit=function(t,n,r){e.Event.listeners[t].forEach(function(e){return e(n,r)})}}},{key:"_lazyLoadHandler",value:function(){var e=this,t=!1;this.ListenerQueue.forEach(function(n,r){n.state.loaded||(t=n.checkInView())&&n.load(function(){!n.error&&n.loaded&&e.ListenerQueue.splice(r,1)})})}},{key:"_initIntersectionObserver",value:function(){var e=this;E&&(this._observer=new IntersectionObserver(this._observerHandler.bind(this),this.options.observerOptions),this.ListenerQueue.length&&this.ListenerQueue.forEach(function(t){e._observer.observe(t.el)}))}},{key:"_observerHandler",value:function(e,t){var n=this;e.forEach(function(e){e.isIntersecting&&n.ListenerQueue.forEach(function(t){if(t.el===e.target){if(t.state.loaded)return n._observer.unobserve(t.el);t.load()}})})}},{key:"_elRenderer",value:function(e,t,n){if(e.el){var r=e.el,i=e.bindType,o=void 0;switch(t){case"loading":o=e.loading;break;case"error":o=e.error;break;default:o=e.src}if(i?r.style[i]='url("'+o+'")':r.getAttribute("src")!==o&&r.setAttribute("src",o),r.setAttribute("lazy",t),this.$emit(t,e,n),this.options.adapter[t]&&this.options.adapter[t](e,this.options),this.options.dispatchEvent){var a=new j(t,{detail:e});r.dispatchEvent(a)}}}},{key:"_valueFormatter",value:function(e){var t=e,n=this.options.loading,r=this.options.error;return c(e)&&(e.src||this.options.silent||console.error("Vue Lazyload warning: miss src with "+e),t=e.src,n=e.loading||this.options.loading,r=e.error||this.options.error),{src:t,loading:n,error:r}}}]),t}()},B=function(e){return{props:{tag:{type:String,default:"div"}},render:function(e){return!1===this.show?e(this.tag):e(this.tag,null,this.$slots.default)},data:function(){return{el:null,state:{loaded:!1},rect:{},show:!1}},mounted:function(){this.el=this.$el,e.addLazyBox(this),e.lazyLoadHandler()},beforeDestroy:function(){e.removeComponent(this)},methods:{getRect:function(){this.rect=this.$el.getBoundingClientRect()},checkInView:function(){return this.getRect(),k&&this.rect.top<window.innerHeight*e.options.preLoad&&this.rect.bottom>0&&this.rect.left<window.innerWidth*e.options.preLoad&&this.rect.right>0},load:function(){this.show=!0,this.state.loaded=!0,this.$emit("show",this)}}}},V=function(){function e(t){var n=t.lazy;b(this,e),this.lazy=n,n.lazyContainerMananger=this,this._queue=[]}return y(e,[{key:"bind",value:function(e,t,n){var r=new N({el:e,binding:t,vnode:n,lazy:this.lazy});this._queue.push(r)}},{key:"update",value:function(e,t,n){var r=u(this._queue,function(t){return t.el===e});r&&r.update({el:e,binding:t,vnode:n})}},{key:"unbind",value:function(e,t,n){var r=u(this._queue,function(t){return t.el===e});r&&(r.clear(),o(this._queue,r))}}]),e}(),M={selector:"img"},N=function(){function e(t){var n=t.el,r=t.binding,i=t.vnode,o=t.lazy;b(this,e),this.el=null,this.vnode=i,this.binding=r,this.options={},this.lazy=o,this._queue=[],this.update({el:n,binding:r})}return y(e,[{key:"update",value:function(e){var t=this,n=e.el,r=e.binding;this.el=n,this.options=_({},M,r.value),this.getImgs().forEach(function(e){t.lazy.add(e,_({},t.binding,{value:{src:e.dataset.src,error:e.dataset.error,loading:e.dataset.loading}}),t.vnode)})}},{key:"getImgs",value:function(){return f(this.el.querySelectorAll(this.options.selector))}},{key:"clear",value:function(){var e=this;this.getImgs().forEach(function(t){return e.lazy.remove(t)}),this.vnode=null,this.binding=null,this.lazy=null}}]),e}();return{install:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=D(e),r=new n(t),i=new V({lazy:r}),o="2"===e.version.split(".")[0];e.prototype.$Lazyload=r,t.lazyComponent&&e.component("lazy-component",B(r)),o?(e.directive("lazy",{bind:r.add.bind(r),update:r.update.bind(r),componentUpdated:r.lazyLoadHandler.bind(r),unbind:r.remove.bind(r)}),e.directive("lazy-container",{bind:i.bind.bind(i),update:i.update.bind(i),unbind:i.unbind.bind(i)})):(e.directive("lazy",{bind:r.lazyLoadHandler.bind(r),update:function(e,t){_(this.vm.$refs,this.vm.$els),r.add(this.el,{modifiers:this.modifiers||{},arg:this.arg,value:e,oldValue:t},{context:this.vm})},unbind:function(){r.remove(this.el)}}),e.directive("lazy-container",{update:function(e,t){i.update(this.el,{modifiers:this.modifiers||{},arg:this.arg,value:e,oldValue:t},{context:this.vm})},unbind:function(){i.unbind(this.el)}}))}}});
/***/ }),
/* 4 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
// EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(1);
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
// EXTERNAL MODULE: ./es/utils/index.js
var utils = __webpack_require__(0);
// CONCATENATED MODULE: ./es/utils/deep-assign.js
var deep_assign_hasOwnProperty = Object.prototype.hasOwnProperty;
function assignKey(to, from, key) {
var val = from[key];
if (!Object(utils["d" /* isDef */])(val) || deep_assign_hasOwnProperty.call(to, key) && !Object(utils["d" /* isDef */])(to[key])) {
return;
}
if (!deep_assign_hasOwnProperty.call(to, key) || !Object(utils["e" /* isObj */])(val)) {
to[key] = val;
} else {
to[key] = deep_assign_assign(Object(to[key]), from[key]);
}
}
function deep_assign_assign(to, from) {
for (var key in from) {
if (deep_assign_hasOwnProperty.call(from, key)) {
assignKey(to, from, key);
}
}
return to;
}
// CONCATENATED MODULE: ./es/locale/lang/zh-CN.js
/* harmony default export */ var zh_CN = ({
name: '姓名',
tel: '电话',
save: '保存',
confirm: '确认',
cancel: '取消',
delete: '删除',
complete: '完成',
loadingTip: '加载中...',
telEmpty: '请填写电话',
nameEmpty: '请填写姓名',
confirmDelete: '确定要删除么',
telInvalid: '请填写正确的电话',
vanContactCard: {
addText: '添加联系人'
},
vanContactList: {
addText: '新建联系人'
},
vanPagination: {
prev: '上一页',
next: '下一页'
},
vanPullRefresh: {
pulling: '下拉即可刷新...',
loosing: '释放即可刷新...'
},
vanSubmitBar: {
label: '合计:'
},
vanCouponCell: {
title: '优惠券',
tips: '使用优惠',
count: function count(_count) {
return "\u60A8\u6709 " + _count + " \u4E2A\u53EF\u7528\u4F18\u60E0";
}
},
vanCouponList: {
empty: '暂无优惠券',
exchange: '兑换',
close: '不使用优惠',
enable: '可使用优惠券',
disabled: '不可使用优惠券',
placeholder: '请输入优惠码'
},
vanCouponItem: {
valid: '有效期',
unlimited: '无使用门槛',
discount: function discount(_discount) {
return _discount + "\u6298";
},
condition: function condition(_condition) {
return "\u6EE1" + _condition + "\u5143\u53EF\u7528";
}
},
vanAddressEdit: {
area: '地区',
postal: '邮政编码',
areaEmpty: '请选择地区',
addressEmpty: '请填写详细地址',
postalEmpty: '邮政编码格式不正确',
defaultAddress: '设为默认收货地址',
telPlaceholder: '收货人手机号',
namePlaceholder: '收货人姓名',
areaPlaceholder: '选择省 / 市 / 区'
},
vanAddressEditDetail: {
label: '详细地址',
placeholder: '街道门牌、楼层房间号等信息'
},
vanAddressList: {
add: '新增地址'
}
});
// CONCATENATED MODULE: ./es/locale/index.js
var proto = external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype;
var defaultLang = 'zh-CN';
var locale = {
install: function install() {
var _Vue$util$defineReact;
if (proto.$vantLang) {
return;
}
external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.util.defineReactive(proto, '$vantLang', defaultLang);
external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.util.defineReactive(proto, '$vantMessages', (_Vue$util$defineReact = {}, _Vue$util$defineReact[defaultLang] = zh_CN, _Vue$util$defineReact));
},
use: function use(lang, messages) {
var _this$add;
proto.$vantLang = lang;
this.add((_this$add = {}, _this$add[lang] = messages, _this$add));
},
add: function add(messages) {
if (messages === void 0) {
messages = {};
}
deep_assign_assign(proto.$vantMessages, messages);
}
};
locale.install();
/* harmony default export */ var es_locale = (locale);
// CONCATENATED MODULE: ./es/mixins/bem.js
/**
* bem helper
* b() // 'button'
* b('text') // 'button__text'
* b({ disabled }) // 'button button--disabled'
* b('text', { disabled }) // 'button__text button__text--disabled'
* b(['disabled', 'primary']) // 'button button--disabled button--primary'
*/
var ELEMENT = '__';
var MODS = '--';
var join = function join(name, el, symbol) {
return el ? name + symbol + el : name;
};
var bem_prefix = function prefix(name, mods) {
if (typeof mods === 'string') {
return join(name, mods, MODS);
}
if (Array.isArray(mods)) {
return mods.map(function (item) {
return prefix(name, item);
});
}
var ret = {};
Object.keys(mods).forEach(function (key) {
ret[name + MODS + key] = mods[key];
});
return ret;
};
/* harmony default export */ var bem = ({
methods: {
b: function b(el, mods) {
var name = this.$options.name;
if (el && typeof el !== 'string') {
mods = el;
el = '';
}
el = join(name, el, ELEMENT);
return mods ? [el, bem_prefix(el, mods)] : el;
}
}
});
// CONCATENATED MODULE: ./es/mixins/i18n.js
// component mixin
/* harmony default export */ var i18n = ({
computed: {
$t: function $t() {
var name = this.$options.name;
var prefix = name ? Object(utils["a" /* camelize */])(name) + '.' : '';
if (!this.$vantMessages) {
if (false) {}
return function () {
return '';
};
}
var messages = this.$vantMessages[this.$vantLang];
return function (path) {
var message = Object(utils["b" /* get */])(messages, prefix + path) || Object(utils["b" /* get */])(messages, path);
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return typeof message === 'function' ? message.apply(null, args) : message;
};
}
}
});
// CONCATENATED MODULE: ./es/utils/create-basic.js
/**
* Create a basic component with common options
*/
var create_basic_install = function install(Vue) {
Vue.component(this.name, this);
};
/* harmony default export */ var create_basic = (function (sfc) {
sfc.name = 'van-' + sfc.name;
sfc.install = sfc.install || create_basic_install;
sfc.mixins = sfc.mixins || [];
sfc.mixins.push(i18n, bem);
sfc.methods = sfc.methods || {};
sfc.methods.isDef = utils["d" /* isDef */];
return sfc;
});
;
// CONCATENATED MODULE: ./es/info/index.js
/* harmony default export */ var info = (create_basic({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _vm.isDef(_vm.info) ? _c('div', {
class: _vm.b()
}, [_vm._v(_vm._s(_vm.info))]) : _vm._e();
},
name: 'info',
props: {
info: [String, Number]
}
}));
// CONCATENATED MODULE: ./es/icon/index.js
var _components;
/* harmony default export */ var icon = (create_basic({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('i', _vm._g({
class: [_vm.classPrefix, _vm.classPrefix + "-" + _vm.name],
style: _vm.style
}, _vm.$listeners), [_vm._t("default"), _c('van-info', {
attrs: {
"info": _vm.info
}
})], 2);
},
name: 'icon',
components: (_components = {}, _components[info.name] = info, _components),
props: {
name: String,
info: [String, Number],
color: String,
size: String,
classPrefix: {
type: String,
default: 'van-icon'
}
},
computed: {
style: function style() {
return {
color: this.color,
fontSize: this.size
};
}
}
}));
// CONCATENATED MODULE: ./es/loading/index.js
var DEFAULT_COLOR = '#c9c9c9';
/* harmony default export */ var loading = (create_basic({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
class: _vm.b([_vm.type, _vm.colorType]),
style: _vm.style
}, [_c('span', {
class: _vm.b('spinner', _vm.type)
}, [_vm._l(_vm.type === 'spinner' ? 12 : 0, function (item, index) {
return _c('i', {
key: index
});
}), _vm.type === 'circular' ? _c('svg', {
class: _vm.b('circular'),
attrs: {
"viewBox": "25 25 50 50"
}
}, [_c('circle', {
attrs: {
"cx": "50",
"cy": "50",
"r": "20",
"fill": "none"
}
})]) : _vm._e()], 2)]);
},
name: 'loading',
props: {
size: String,
type: {
type: String,
default: 'circular'
},
color: {
type: String,
default: DEFAULT_COLOR
}
},
computed: {
colorType: function colorType() {
var color = this.color;
return color === 'white' || color === 'black' ? color : '';
},
style: function style() {
return {
color: this.color === 'black' ? DEFAULT_COLOR : this.color,
width: this.size,
height: this.size
};
}
}
}));
// CONCATENATED MODULE: ./es/mixins/router-link.js
/**
* add Vue-Router support
*/
/* harmony default export */ var router_link = ({
props: {
url: String,
replace: Boolean,
to: [String, Object]
},
methods: {
routerLink: function routerLink() {
var to = this.to,
url = this.url,
$router = this.$router,
replace = this.replace;
if (to && $router) {
$router[replace ? 'replace' : 'push'](to);
} else if (url) {
replace ? location.replace(url) : location.href = url;
}
}
}
});
// CONCATENATED MODULE: ./es/cell/index.js
/* harmony default export */ var cell = (create_basic({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
class: [_vm.b({
center: _vm.center,
required: _vm.required,
clickable: _vm.isLink || _vm.clickable
}), {
'van-hairline': _vm.border
}],
on: {
"click": _vm.onClick
}
}, [_vm._t("icon", [_vm.icon ? _c('icon', {
class: _vm.b('left-icon'),
attrs: {
"name": _vm.icon
}
}) : _vm._e()]), _vm.isDef(_vm.title) || _vm.$slots.title ? _c('div', {
class: _vm.b('title')
}, [_vm._t("title", [_c('span', {
domProps: {
"textContent": _vm._s(_vm.title)
}
}), _vm.label ? _c('div', {
class: _vm.b('label'),
domProps: {
"textContent": _vm._s(_vm.label)
}
}) : _vm._e()])], 2) : _vm._e(), _vm.isDef(_vm.value) || _vm.$slots.default ? _c('div', {
class: _vm.b('value', {
alone: !_vm.$slots.title && !_vm.title
})
}, [_vm._t("default", [_c('span', {
domProps: {
"textContent": _vm._s(_vm.value)
}
})])], 2) : _vm._e(), _vm._t("right-icon", [_vm.isLink ? _c('icon', {
class: _vm.b('right-icon', _vm.arrowDirection),
attrs: {
"name": "arrow"
}
}) : _vm._e()]), _vm._t("extra")], 2);
},
name: 'cell',
components: {
Icon: icon
},
mixins: [router_link],
props: {
icon: String,
label: String,
center: Boolean,
isLink: Boolean,
required: Boolean,
clickable: Boolean,
title: [String, Number],
value: [String, Number],
arrowDirection: String,
border: {
type: Boolean,
default: true
}
},
methods: {
onClick: function onClick() {
this.$emit('click');
this.routerLink();
}
}
}));
// CONCATENATED MODULE: ./es/cell-group/index.js
/* harmony default export */ var cell_group = (create_basic({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('div', {
class: [_vm.b(), {
'van-hairline--top-bottom': _vm.border
}]
}, [_vm._t("default")], 2);
},
name: 'cell-group',
props: {
border: {
type: Boolean,
default: true
}
}
}));
// CONCATENATED MODULE: ./es/utils/create.js
/**
* Create a component with common options
*/
/* harmony default export */ var create = (function (sfc) {
sfc.components = _extends(sfc.components || {}, {
Icon: icon,
Loading: loading,
Cell: cell,
CellGroup: cell_group
});
return create_basic(sfc);
});
;
// CONCATENATED MODULE: ./es/mixins/popup/Modal.js
/* harmony default export */ var Modal = ({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('transition', {
attrs: {
"name": "van-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: _vm.visible,
expression: "visible"
}],
staticClass: "van-modal",
class: _vm.className,
style: _vm.style,
on: {
"touchmove": function touchmove($event) {
$event.preventDefault();
$event.stopPropagation();
},
"click": function click($event) {
_vm.$emit('click', $event);
}
}
})]);
},
name: 'modal',
props: {
visible: Boolean,
zIndex: Number,
className: String,
customStyle: Object
},
computed: {
style: function style() {
return _extends({
zIndex: this.zIndex
}, this.customStyle);
}
}
});
// CONCATENATED MODULE: ./es/mixins/popup/context.js
/* harmony default export */ var popup_context = ({
id: 1,
zIndex: 2000,
stack: [],
lockCount: 0,
plusKey: function plusKey(key) {
return this[key]++;
},
get top() {
return this.stack[this.stack.length - 1];
}
});
// CONCATENATED MODULE: ./es/mixins/popup/manager.js
var defaultConfig = {
className: '',
customStyle: {}
};
/* harmony default export */ var manager = ({
open: function open(vm, config) {
/* istanbul ignore next */
if (!popup_context.stack.some(function (item) {
return item.vm._popupId === vm._popupId;
})) {
var el = vm.$el;
var targetNode = el && el.parentNode && el.parentNode.nodeType !== 11 ? el.parentNode : document.body;
popup_context.stack.push({
vm: vm,
config: config,
targetNode: targetNode
});
this.update();
}
;
},
close: function close(id) {
var stack = popup_context.stack;
if (stack.length) {
if (popup_context.top.vm._popupId === id) {
stack.pop();
this.update();
} else {
popup_context.stack = stack.filter(function (item) {
return item.vm._popupId !== id;
});
}
}
},
update: function update() {
var modal = popup_context.modal;
if (!modal) {
modal = new (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.extend(Modal))({
el: document.createElement('div')
});
modal.$on('click', this.onClick);
popup_context.modal = modal;
}
if (modal.$el.parentNode) {
modal.visible = false;
}
if (popup_context.top) {
var _context$top = popup_context.top,
targetNode = _context$top.targetNode,
config = _context$top.config;
targetNode.appendChild(modal.$el);
_extends(modal, _extends({}, defaultConfig, config, {
visible: true
}));
}
},
// close popup when click modal && closeOnClickOverlay is true
onClick: function onClick() {
/* istanbul ignore else */
if (popup_context.top) {
var vm = popup_context.top.vm;
vm.$emit('click-overlay');
vm.closeOnClickOverlay && vm.$emit('input', false);
}
}
});
// CONCATENATED MODULE: ./es/utils/scroll.js
/* harmony default export */ var utils_scroll = ({
// get nearest scroll element
getScrollEventTarget: function getScrollEventTarget(element, rootParent) {
if (rootParent === void 0) {
rootParent = window;
}
var currentNode = element; // bugfix, see http://w3help.org/zh-cn/causes/SD9013 and http://stackoverflow.com/questions/17016740/onscroll-function-is-not-working-for-chrome
while (currentNode && currentNode.tagName !== 'HTML' && currentNode.tagName !== 'BODY' && currentNode.nodeType === 1 && currentNode !== rootParent) {
var overflowY = this.getComputedStyle(currentNode).overflowY;
if (overflowY === 'scroll' || overflowY === 'auto') {
return currentNode;
}
currentNode = currentNode.parentNode;
}
return rootParent;
},
getScrollTop: function getScrollTop(element) {
return 'scrollTop' in element ? element.scrollTop : element.pageYOffset;
},
setScrollTop: function setScrollTop(element, value) {
'scrollTop' in element ? element.scrollTop = value : element.scrollTo(element.scrollX, value);
},
// get distance from element top to page top
getElementTop: function getElementTop(element) {
return (element === window ? 0 : element.getBoundingClientRect().top) + this.getScrollTop(window);
},
getVisibleHeight: function getVisibleHeight(element) {
return element === window ? element.innerHeight : element.getBoundingClientRect().height;
},
getComputedStyle: !utils["f" /* isServer */] && document.defaultView.getComputedStyle.bind(document.defaultView)
});
// CONCATENATED MODULE: ./es/utils/event.js
var supportsPassive = false;
if (!utils["f" /* isServer */]) {
try {
var opts = {};
Object.defineProperty(opts, 'passive', {
get: function get() {
/* istanbul ignore next */
supportsPassive = true;
}
});
window.addEventListener('test-passive', null, opts);
} catch (e) {}
}
function on(target, event, handler, passive) {
if (passive === void 0) {
passive = false;
}
!utils["f" /* isServer */] && target.addEventListener(event, handler, supportsPassive ? {
capture: false,
passive: passive
} : false);
}
function off(target, event, handler) {
!utils["f" /* isServer */] && target.removeEventListener(event, handler);
}
// CONCATENATED MODULE: ./es/mixins/touch.js
/* harmony default export */ var touch = ({
methods: {
touchStart: function touchStart(event) {
this.resetTouchStatus();
this.startX = event.touches[0].clientX;
this.startY = event.touches[0].clientY;
},
touchMove: function touchMove(event) {
var touch = event.touches[0];
this.deltaX = touch.clientX - this.startX;
this.deltaY = touch.clientY - this.startY;
this.offsetX = Math.abs(this.deltaX);
this.offsetY = Math.abs(this.deltaY);
this.direction = this.offsetX > this.offsetY ? 'horizontal' : this.offsetX < this.offsetY ? 'vertical' : '';
},
resetTouchStatus: function resetTouchStatus() {
this.direction = '';
this.deltaX = 0;
this.deltaY = 0;
this.offsetX = 0;
this.offsetY = 0;
}
}
});
// CONCATENATED MODULE: ./es/mixins/popup/index.js
/* harmony default export */ var popup = ({
mixins: [touch],
props: {
// whether to show popup
value: Boolean,
// whether to show overlay
overlay: Boolean,
// overlay custom style
overlayStyle: Object,
// overlay custom class name
overlayClass: String,
// whether to close popup when click overlay
closeOnClickOverlay: Boolean,
// z-index
zIndex: [String, Number],
// return the mount node for popup
getContainer: [String, Function],
// prevent body scroll
lockScroll: {
type: Boolean,
default: true
},
// whether to lazy render
lazyRender: {
type: Boolean,
default: true
}
},
data: function data() {
return {
inited: this.value
};
},
computed: {
shouldRender: function shouldRender() {
return this.inited || !this.lazyRender;
}
},
watch: {
value: function value(val) {
this.inited = this.inited || this.value;
this[val ? 'open' : 'close']();
},
getContainer: function getContainer() {
this.move();
},
overlay: function overlay() {
this.renderOverlay();
}
},
created: function created() {
this._popupId = 'popup-' + popup_context.plusKey('id');
},
mounted: function mounted() {
if (this.getContainer) {
this.move();
}
if (this.value) {
this.open();
}
},
activated: function activated() {
/* istanbul ignore next */
if (this.value) {
this.open();
}
},
beforeDestroy: function beforeDestroy() {
this.close();
if (this.getContainer) {
this.$parent.$el.appendChild(this.$el);
}
},
deactivated: function deactivated() {
/* istanbul ignore next */
this.close();
},
methods: {
open: function open() {
/* istanbul ignore next */
if (this.$isServer || this.opened) {
return;
} // 如果属性中传入了`zIndex`,则覆盖`context`中对应的`zIndex`
if (this.zIndex !== undefined) {
popup_context.zIndex = this.zIndex;
}
this.opened = true;
this.renderOverlay();
if (this.lockScroll) {
on(document, 'touchstart', this.touchStart);
on(document, 'touchmove', this.onTouchMove);
if (!popup_context.lockCount) {
document.body.classList.add('van-overflow-hidden');
}
popup_context.lockCount++;
}
},
close: function close() {
if (!this.opened) {
return;
}
if (this.lockScroll) {
popup_context.lockCount--;
off(document, 'touchstart', this.touchStart);
off(document, 'touchmove', this.onTouchMove);
if (!popup_context.lockCount) {
document.body.classList.remove('van-overflow-hidden');
}
}
this.opened = false;
manager.close(this._popupId);
this.$emit('input', false);
},
move: function move() {
var container;
var getContainer = this.getContainer;
if (getContainer) {
container = typeof getContainer === 'string' ? document.querySelector(getContainer) : getContainer();
} else if (this.$parent) {
container = this.$parent.$el;
}
if (container) {
container.appendChild(this.$el);
}
},
onTouchMove: function onTouchMove(e) {
this.touchMove(e);
var direction = this.deltaY > 0 ? '10' : '01';
var el = utils_scroll.getScrollEventTarget(e.target, this.$el);
var scrollHeight = el.scrollHeight,
offsetHeight = el.offsetHeight,
scrollTop = el.scrollTop;
var status = '11';
/* istanbul ignore next */
if (scrollTop === 0) {
status = offsetHeight >= scrollHeight ? '00' : '01';
} else if (scrollTop + offsetHeight >= scrollHeight) {
status = '10';
}
/* istanbul ignore next */
if (status !== '11' && this.direction === 'vertical' && !(parseInt(status, 2) & parseInt(direction, 2))) {
e.preventDefault();
e.stopPropagation();
}
},
renderOverlay: function renderOverlay() {
var _this = this;
if (this.overlay) {
manager.open(this, {
zIndex: popup_context.plusKey('zIndex'),
className: this.overlayClass,
customStyle: this.overlayStyle
});
} else {
manager.close(this._popupId);
}
this.$nextTick(function () {
_this.$el.style.zIndex = popup_context.plusKey('zIndex');
});
}
}
});
// CONCATENATED MODULE: ./es/actionsheet/index.js
/* harmony default export */ var actionsheet = (create({
render: function render() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c('transition', {
attrs: {
"name": "van-slide-bottom"
}
}, [_vm.shouldRender ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: _vm.value,
expression: "value"
}],
class: _vm.b({
'withtitle': _vm.title
})
}, [_vm.title ? _c('div', {
staticClass: "van-hairline--top-bottom",
class: _vm.b('header')
}, [_c('div', {
dom