123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define("vantExt", [], factory);
- else if(typeof exports === 'object')
- exports["vantExt"] = factory();
- else
- root["vantExt"] = factory();
- })(typeof self !== 'undefined' ? self : this, function() {
- 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 = 4);
- /******/ })
- /************************************************************************/
- /******/ ([
- /* 0 */
- /***/ (function(module, exports, __webpack_require__) {
- var api = __webpack_require__(1);
- var content = __webpack_require__(2);
- content = content.__esModule ? content.default : content;
- if (typeof content === 'string') {
- content = [[module.i, content, '']];
- }
- var options = {};
- options.insert = "head";
- options.singleton = false;
- var update = api(content, options);
- module.exports = content.locals || {};
- /***/ }),
- /* 1 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isOldIE = function isOldIE() {
- var memo;
- return function memorize() {
- if (typeof memo === 'undefined') {
- // Test for IE <= 9 as proposed by Browserhacks
- // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
- // Tests for existence of standard globals is to allow style-loader
- // to operate correctly into non-standard environments
- // @see https://github.com/webpack-contrib/style-loader/issues/177
- memo = Boolean(window && document && document.all && !window.atob);
- }
- return memo;
- };
- }();
- var getTarget = function getTarget() {
- var memo = {};
- return function memorize(target) {
- if (typeof memo[target] === 'undefined') {
- var styleTarget = document.querySelector(target); // Special case to return head of iframe instead of iframe itself
- if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
- try {
- // This will throw an exception if access to iframe is blocked
- // due to cross-origin restrictions
- styleTarget = styleTarget.contentDocument.head;
- } catch (e) {
- // istanbul ignore next
- styleTarget = null;
- }
- }
- memo[target] = styleTarget;
- }
- return memo[target];
- };
- }();
- var stylesInDom = [];
- function getIndexByIdentifier(identifier) {
- var result = -1;
- for (var i = 0; i < stylesInDom.length; i++) {
- if (stylesInDom[i].identifier === identifier) {
- result = i;
- break;
- }
- }
- return result;
- }
- function modulesToDom(list, options) {
- var idCountMap = {};
- var identifiers = [];
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- var id = options.base ? item[0] + options.base : item[0];
- var count = idCountMap[id] || 0;
- var identifier = "".concat(id, " ").concat(count);
- idCountMap[id] = count + 1;
- var index = getIndexByIdentifier(identifier);
- var obj = {
- css: item[1],
- media: item[2],
- sourceMap: item[3]
- };
- if (index !== -1) {
- stylesInDom[index].references++;
- stylesInDom[index].updater(obj);
- } else {
- stylesInDom.push({
- identifier: identifier,
- updater: addStyle(obj, options),
- references: 1
- });
- }
- identifiers.push(identifier);
- }
- return identifiers;
- }
- function insertStyleElement(options) {
- var style = document.createElement('style');
- var attributes = options.attributes || {};
- if (typeof attributes.nonce === 'undefined') {
- var nonce = true ? __webpack_require__.nc : undefined;
- if (nonce) {
- attributes.nonce = nonce;
- }
- }
- Object.keys(attributes).forEach(function (key) {
- style.setAttribute(key, attributes[key]);
- });
- if (typeof options.insert === 'function') {
- options.insert(style);
- } else {
- var target = getTarget(options.insert || 'head');
- if (!target) {
- throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
- }
- target.appendChild(style);
- }
- return style;
- }
- function removeStyleElement(style) {
- // istanbul ignore if
- if (style.parentNode === null) {
- return false;
- }
- style.parentNode.removeChild(style);
- }
- /* istanbul ignore next */
- var replaceText = function replaceText() {
- var textStore = [];
- return function replace(index, replacement) {
- textStore[index] = replacement;
- return textStore.filter(Boolean).join('\n');
- };
- }();
- function applyToSingletonTag(style, index, remove, obj) {
- var css = remove ? '' : obj.media ? "@media ".concat(obj.media, " {").concat(obj.css, "}") : obj.css; // For old IE
- /* istanbul ignore if */
- if (style.styleSheet) {
- style.styleSheet.cssText = replaceText(index, css);
- } else {
- var cssNode = document.createTextNode(css);
- var childNodes = style.childNodes;
- if (childNodes[index]) {
- style.removeChild(childNodes[index]);
- }
- if (childNodes.length) {
- style.insertBefore(cssNode, childNodes[index]);
- } else {
- style.appendChild(cssNode);
- }
- }
- }
- function applyToTag(style, options, obj) {
- var css = obj.css;
- var media = obj.media;
- var sourceMap = obj.sourceMap;
- if (media) {
- style.setAttribute('media', media);
- } else {
- style.removeAttribute('media');
- }
- if (sourceMap && btoa) {
- css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
- } // For old IE
- /* istanbul ignore if */
- if (style.styleSheet) {
- style.styleSheet.cssText = css;
- } else {
- while (style.firstChild) {
- style.removeChild(style.firstChild);
- }
- style.appendChild(document.createTextNode(css));
- }
- }
- var singleton = null;
- var singletonCounter = 0;
- function addStyle(obj, options) {
- var style;
- var update;
- var remove;
- if (options.singleton) {
- var styleIndex = singletonCounter++;
- style = singleton || (singleton = insertStyleElement(options));
- update = applyToSingletonTag.bind(null, style, styleIndex, false);
- remove = applyToSingletonTag.bind(null, style, styleIndex, true);
- } else {
- style = insertStyleElement(options);
- update = applyToTag.bind(null, style, options);
- remove = function remove() {
- removeStyleElement(style);
- };
- }
- update(obj);
- return function updateStyle(newObj) {
- if (newObj) {
- if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) {
- return;
- }
- update(obj = newObj);
- } else {
- remove();
- }
- };
- }
- module.exports = function (list, options) {
- options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
- // tags it will allow on a page
- if (!options.singleton && typeof options.singleton !== 'boolean') {
- options.singleton = isOldIE();
- }
- list = list || [];
- var lastIdentifiers = modulesToDom(list, options);
- return function update(newList) {
- newList = newList || [];
- if (Object.prototype.toString.call(newList) !== '[object Array]') {
- return;
- }
- for (var i = 0; i < lastIdentifiers.length; i++) {
- var identifier = lastIdentifiers[i];
- var index = getIndexByIdentifier(identifier);
- stylesInDom[index].references--;
- }
- var newLastIdentifiers = modulesToDom(newList, options);
- for (var _i = 0; _i < lastIdentifiers.length; _i++) {
- var _identifier = lastIdentifiers[_i];
- var _index = getIndexByIdentifier(_identifier);
- if (stylesInDom[_index].references === 0) {
- stylesInDom[_index].updater();
- stylesInDom.splice(_index, 1);
- }
- }
- lastIdentifiers = newLastIdentifiers;
- };
- };
- /***/ }),
- /* 2 */
- /***/ (function(module, exports, __webpack_require__) {
- // Imports
- var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(3);
- exports = ___CSS_LOADER_API_IMPORT___(false);
- // Module
- exports.push([module.i, ".demo-button{min-width:120px;color:#fff;font-size:16px;line-height:36px;background-color:#f44;border:none;border-radius:30px}", ""]);
- // Exports
- module.exports = exports;
- /***/ }),
- /* 3 */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
- */
- // css base code, injected by the css-loader
- // eslint-disable-next-line func-names
- module.exports = function (useSourceMap) {
- var list = []; // return the list of modules as css string
- list.toString = function toString() {
- return this.map(function (item) {
- var content = cssWithMappingToString(item, useSourceMap);
- if (item[2]) {
- return "@media ".concat(item[2], " {").concat(content, "}");
- }
- return content;
- }).join('');
- }; // import a list of modules into the list
- // eslint-disable-next-line func-names
- list.i = function (modules, mediaQuery, dedupe) {
- if (typeof modules === 'string') {
- // eslint-disable-next-line no-param-reassign
- modules = [[null, modules, '']];
- }
- var alreadyImportedModules = {};
- if (dedupe) {
- for (var i = 0; i < this.length; i++) {
- // eslint-disable-next-line prefer-destructuring
- var id = this[i][0];
- if (id != null) {
- alreadyImportedModules[id] = true;
- }
- }
- }
- for (var _i = 0; _i < modules.length; _i++) {
- var item = [].concat(modules[_i]);
- if (dedupe && alreadyImportedModules[item[0]]) {
- // eslint-disable-next-line no-continue
- continue;
- }
- if (mediaQuery) {
- if (!item[2]) {
- item[2] = mediaQuery;
- } else {
- item[2] = "".concat(mediaQuery, " and ").concat(item[2]);
- }
- }
- list.push(item);
- }
- };
- return list;
- };
- function cssWithMappingToString(item, useSourceMap) {
- var content = item[1] || ''; // eslint-disable-next-line prefer-destructuring
- var cssMapping = item[3];
- if (!cssMapping) {
- return content;
- }
- if (useSourceMap && typeof btoa === 'function') {
- var sourceMapping = toComment(cssMapping);
- var sourceURLs = cssMapping.sources.map(function (source) {
- return "/*# sourceURL=".concat(cssMapping.sourceRoot || '').concat(source, " */");
- });
- return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
- }
- return [content].join('\n');
- } // Adapted from convert-source-map (MIT)
- function toComment(sourceMap) {
- // eslint-disable-next-line no-undef
- var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
- var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
- return "/*# ".concat(data, " */");
- }
- /***/ }),
- /* 4 */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "install", function() { return /* binding */ install; });
- __webpack_require__.d(__webpack_exports__, "version", function() { return /* binding */ version; });
- __webpack_require__.d(__webpack_exports__, "DemoButton", function() { return /* reexport */ demo_button; });
- __webpack_require__.d(__webpack_exports__, "IndexList", function() { return /* reexport */ index_list; });
- __webpack_require__.d(__webpack_exports__, "SvgIcon", function() { return /* reexport */ svg_icon; });
- // EXTERNAL MODULE: ./es/demo-button/index-sfc.css
- var index_sfc = __webpack_require__(0);
- // CONCATENATED MODULE: ./es/demo-button/index.js
- var __vue_render__ = function __vue_render__() {
- var _vm = this;
- var _h = _vm.$createElement;
- var _c = _vm._self._c || _h;
- return _c('button', {
- staticClass: "demo-button"
- }, [_vm._t("default")], 2);
- };
- var __vue_staticRenderFns__ = [];
- /* harmony default export */ var demo_button = ({
- render: __vue_render__,
- staticRenderFns: __vue_staticRenderFns__,
- name: 'demo-button',
- props: {
- color: String,
- type: {
- type: String,
- default: 'primary'
- }
- }
- });
- // CONCATENATED MODULE: ./es/index-list/index.js
- var INDICATOR_INDURATION = 1000;
- var TITLE_HEIGHT = 30;
- var index_list_vue_render_ = function __vue_render__() {
- var _vm = this;
- var _h = _vm.$createElement;
- var _c = _vm._self._c || _h;
- return _c('div', {
- staticClass: "index-list"
- }, [_c('ul', {
- ref: "indexWrap",
- staticClass: "index-list-wrap",
- on: {
- "scroll": _vm.onListWrapScroll
- }
- }, _vm._l(_vm.data, function (group, index) {
- return _c('li', {
- key: index,
- ref: "indexGroup",
- refInFor: true,
- staticClass: "index-group"
- }, [_c('h3', {
- staticClass: "index-group-title"
- }, [_vm._v(_vm._s(group.title))]), _vm._v(" "), _c('ul', _vm._l(group.items, function (item, index) {
- return _c('li', {
- key: index,
- staticClass: "index-group-item",
- on: {
- "click": function click($event) {
- return _vm.clickItem(item);
- }
- }
- }, [_vm._t("default", null, {
- "item": item
- })], 2);
- }), 0)]);
- }), 0), _vm._v(" "), _c('div', {
- staticClass: "index-nav"
- }, [_c('ul', _vm._l(_vm.indexList, function (item, index) {
- return _c('li', {
- key: index,
- staticClass: "nav-item",
- class: {
- 'active': _vm.currentIndex === index
- },
- attrs: {
- "data-index": index
- },
- on: {
- "touchstart": function touchstart($event) {
- $event.preventDefault();
- return _vm._onTouchStartIndex(index);
- }
- }
- }, [_vm._v(_vm._s(item))]);
- }), 0)]), _vm._v(" "), _c('transition', {
- attrs: {
- "name": "fade"
- }
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: _vm.moving,
- expression: "moving"
- }],
- staticClass: "index-indicator"
- }, [_vm._v(_vm._s(_vm.currentIndicator))])])], 1);
- };
- var index_list_vue_staticRenderFns_ = [];
- /* harmony default export */ var index_list = ({
- render: index_list_vue_render_,
- staticRenderFns: index_list_vue_staticRenderFns_,
- name: "van-index-list",
- props: {
- data: {
- type: Array,
- default: function _default() {
- return [];
- }
- }
- },
- data: function data() {
- return {
- currentIndex: 0,
- moving: false,
- currentIndicator: ''
- };
- },
- watch: {
- currentIndex: function currentIndex(newVal) {
- var _this = this;
- clearTimeout(this.timer);
- this.currentIndicator = this.indexList[this.currentIndex];
- this.moving = true;
- this.timer = setTimeout(function () {
- _this.moving = false;
- }, INDICATOR_INDURATION);
- }
- },
- computed: {
- indexList: function indexList() {
- return this.data.map(function (group) {
- return group.title.substring(0, 1);
- });
- }
- },
- created: function created() {
- this.listHeight = [];
- this.timer = null;
- this.scrollTimer = null;
- },
- mounted: function mounted() {
- var _this2 = this;
- setTimeout(function () {
- _this2._calculateHeight();
- }, 20);
- },
- methods: {
- _calculateHeight: function _calculateHeight() {
- this.listHeight = [];
- var list = this.$refs.indexGroup;
- var height = 0;
- this.listHeight.push(height);
- for (var i = 0; i < list.length; i++) {
- var item = list[i];
- height += item.clientHeight;
- this.listHeight.push(height);
- }
- },
- _onTouchStartIndex: function _onTouchStartIndex(index) {
- this.currentIndex = index;
- this.$refs.indexWrap.scrollTop = this.listHeight[index];
- },
- clickItem: function clickItem(item) {
- this.$emit('choose', item);
- },
- onListWrapScroll: function onListWrapScroll(e) {
- var _this3 = this;
- clearTimeout(this.scrollTimer);
- this.scrollTimer = setTimeout(function () {
- var scrollTop = _this3.$refs.indexWrap.scrollTop;
- var listHeight = _this3.listHeight;
- for (var i = 0; i < listHeight.length - 1; i++) {
- if (scrollTop <= listHeight[i + 1] - TITLE_HEIGHT && scrollTop >= listHeight[i]) {
- _this3.currentIndex = i;
- return;
- }
- }
- }, 20);
- },
- scrollToByTitle: function scrollToByTitle(title) {
- var indexList = this.indexList;
- for (var i = 0; i < indexList.length; i++) {
- if (indexList[i] == title) {
- this._onTouchStartIndex(i);
- }
- }
- },
- scrollToY: function scrollToY(y) {
- this.$refs.indexWrap.scrollTop = y;
- },
- scrollToTop: function scrollToTop() {
- this.$refs.indexWrap.scrollTop = 0;
- },
- scrollToBottom: function scrollToBottom() {
- this.$refs.indexWrap.scrollTop = this.$refs.indexWrap.scrollHeight;
- }
- },
- destroyed: function destroyed() {
- clearTimeout(this.timer);
- clearTimeout(this.scrollTimer);
- }
- });
- // CONCATENATED MODULE: ./es/svg-icon/index.js
- var svg_icon_vue_render_ = function __vue_render__() {
- var _vm = this;
- var _h = _vm.$createElement;
- var _c = _vm._self._c || _h;
- return _c('span', [_c('svg', {
- class: _vm.svgClass,
- attrs: {
- "aria-hidden": "true"
- }
- }, [_c('use', {
- attrs: {
- "xlink:href": _vm.iconName
- }
- })])]);
- };
- var svg_icon_vue_staticRenderFns_ = [];
- /* harmony default export */ var svg_icon = ({
- render: svg_icon_vue_render_,
- staticRenderFns: svg_icon_vue_staticRenderFns_,
- name: "van-svg-icon",
- props: {
- iconClass: {
- type: String,
- required: true
- },
- className: {
- type: String,
- default: ""
- }
- },
- computed: {
- iconName: function iconName() {
- return "#icon-" + this.iconClass;
- },
- svgClass: function svgClass() {
- if (this.className) {
- return "svg-icon " + this.className;
- } else {
- return "svg-icon";
- }
- }
- }
- });
- // CONCATENATED MODULE: ./es/index.js
- var version = '1.0.0';
- function install(Vue) {
- var components = [demo_button, index_list, svg_icon];
- components.forEach(function (item) {
- if (item.install) {
- Vue.use(item);
- } else if (item.name) {
- Vue.component(item.name, item);
- }
- });
- }
- if (typeof window !== 'undefined' && window.Vue) {
- install(window.Vue);
- }
- /* harmony default export */ var es = __webpack_exports__["default"] = ({
- install: install,
- version: version
- });
- /***/ })
- /******/ ]);
- });
|