1 |
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("vantExt",[],e):"object"==typeof exports?exports.vantExt=e():t.vantExt=e()}("undefined"!=typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){var r=n(1),i=n(2);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.i,i,""]]);var o={insert:"head",singleton:!1};r(i,o);t.exports=i.locals||{}},function(t,e,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},o=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),s=[];function a(t){for(var e=-1,n=0;n<s.length;n++)if(s[n].identifier===t){e=n;break}return e}function c(t,e){for(var n={},r=[],i=0;i<t.length;i++){var o=t[i],c=e.base?o[0]+e.base:o[0],u=n[c]||0,l="".concat(c," ").concat(u);n[c]=u+1;var f=a(l),d={css:o[1],media:o[2],sourceMap:o[3]};-1!==f?(s[f].references++,s[f].updater(d)):s.push({identifier:l,updater:m(d,e),references:1}),r.push(l)}return r}function u(t){var e=document.createElement("style"),r=t.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(t){e.setAttribute(t,r[t])})),"function"==typeof t.insert)t.insert(e);else{var s=o(t.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(e)}return e}var l,f=(l=[],function(t,e){return l[t]=e,l.filter(Boolean).join("\n")});function d(t,e,n,r){var i=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(t.styleSheet)t.styleSheet.cssText=f(e,i);else{var o=document.createTextNode(i),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}function p(t,e,n){var r=n.css,i=n.media,o=n.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),o&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}var h=null,v=0;function m(t,e){var n,r,i;if(e.singleton){var o=v++;n=h||(h=u(e)),r=d.bind(null,n,o,!1),i=d.bind(null,n,o,!0)}else n=u(e),r=p.bind(null,n,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=i());var n=c(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var r=0;r<n.length;r++){var i=a(n[r]);s[i].references--}for(var o=c(t,e),u=0;u<n.length;u++){var l=a(n[u]);0===s[l].references&&(s[l].updater(),s.splice(l,1))}n=o}}}},function(t,e,n){(e=n(3)(!1)).push([t.i,".demo-button{min-width:120px;color:#fff;font-size:16px;line-height:36px;background-color:#f44;border:none;border-radius:30px}",""]),t.exports=e},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(c," */")),o=r.sources.map((function(t){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(t," */")}));return[n].concat(o).concat([i]).join("\n")}var s,a,c;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,r){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(r)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(i[s]=!0)}for(var a=0;a<t.length;a++){var c=[].concat(t[a]);r&&i[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),e.push(c))}},e}},function(t,e,n){"use strict";n.r(e),n.d(e,"install",(function(){return a})),n.d(e,"version",(function(){return s})),n.d(e,"DemoButton",(function(){return r})),n.d(e,"IndexList",(function(){return i})),n.d(e,"SvgIcon",(function(){return o}));n(0);var r={render:function(){var t=this.$createElement;return(this._self._c||t)("button",{staticClass:"demo-button"},[this._t("default")],2)},staticRenderFns:[],name:"demo-button",props:{color:String,type:{type:String,default:"primary"}}},i={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"index-list"},[n("ul",{ref:"indexWrap",staticClass:"index-list-wrap",on:{scroll:t.onListWrapScroll}},t._l(t.data,(function(e,r){return n("li",{key:r,ref:"indexGroup",refInFor:!0,staticClass:"index-group"},[n("h3",{staticClass:"index-group-title"},[t._v(t._s(e.title))]),t._v(" "),n("ul",t._l(e.items,(function(e,r){return n("li",{key:r,staticClass:"index-group-item",on:{click:function(n){return t.clickItem(e)}}},[t._t("default",null,{item:e})],2)})),0)])})),0),t._v(" "),n("div",{staticClass:"index-nav"},[n("ul",t._l(t.indexList,(function(e,r){return n("li",{key:r,staticClass:"nav-item",class:{active:t.currentIndex===r},attrs:{"data-index":r},on:{touchstart:function(e){return e.preventDefault(),t._onTouchStartIndex(r)}}},[t._v(t._s(e))])})),0)]),t._v(" "),n("transition",{attrs:{name:"fade"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t.moving,expression:"moving"}],staticClass:"index-indicator"},[t._v(t._s(t.currentIndicator))])])],1)},staticRenderFns:[],name:"van-index-list",props:{data:{type:Array,default:function(){return[]}}},data:function(){return{currentIndex:0,moving:!1,currentIndicator:""}},watch:{currentIndex:function(t){var e=this;clearTimeout(this.timer),this.currentIndicator=this.indexList[this.currentIndex],this.moving=!0,this.timer=setTimeout((function(){e.moving=!1}),1e3)}},computed:{indexList:function(){return this.data.map((function(t){return t.title.substring(0,1)}))}},created:function(){this.listHeight=[],this.timer=null,this.scrollTimer=null},mounted:function(){var t=this;setTimeout((function(){t._calculateHeight()}),20)},methods:{_calculateHeight:function(){this.listHeight=[];var t=this.$refs.indexGroup,e=0;this.listHeight.push(e);for(var n=0;n<t.length;n++){e+=t[n].clientHeight,this.listHeight.push(e)}},_onTouchStartIndex:function(t){this.currentIndex=t,this.$refs.indexWrap.scrollTop=this.listHeight[t]},clickItem:function(t){this.$emit("choose",t)},onListWrapScroll:function(t){var e=this;clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout((function(){for(var t=e.$refs.indexWrap.scrollTop,n=e.listHeight,r=0;r<n.length-1;r++)if(t<=n[r+1]-30&&t>=n[r])return void(e.currentIndex=r)}),20)},scrollToByTitle:function(t){for(var e=this.indexList,n=0;n<e.length;n++)e[n]==t&&this._onTouchStartIndex(n)},scrollToY:function(t){this.$refs.indexWrap.scrollTop=t},scrollToTop:function(){this.$refs.indexWrap.scrollTop=0},scrollToBottom:function(){this.$refs.indexWrap.scrollTop=this.$refs.indexWrap.scrollHeight}},destroyed:function(){clearTimeout(this.timer),clearTimeout(this.scrollTimer)}},o={render:function(){var t=this.$createElement,e=this._self._c||t;return e("span",[e("svg",{class:this.svgClass,attrs:{"aria-hidden":"true"}},[e("use",{attrs:{"xlink:href":this.iconName}})])])},staticRenderFns:[],name:"van-svg-icon",props:{iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{iconName:function(){return"#icon-"+this.iconClass},svgClass:function(){return this.className?"svg-icon "+this.className:"svg-icon"}}},s="1.0.0";function a(t){[r,i,o].forEach((function(e){e.install?t.use(e):e.name&&t.component(e.name,e)}))}"undefined"!=typeof window&&window.Vue&&a(window.Vue);e.default={install:a,version:s}}])}));
|