w-ui
Version:
A Vue.js 2.0 UI Toolkit for mobile
1 lines • 9.4 kB
JavaScript
module.exports=function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=102)}({1:function(t,e,n){"use strict";function i(t,e){var n=t[1]||"",i=t[3];if(!i)return n;if(e&&"function"==typeof btoa){var o=s(i);return[n].concat(i.sources.map(function(t){return"/*# sourceURL="+i.sourceRoot+t+" */"})).concat([o]).join("\n")}return[n].join("\n")}function s(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=i(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},s=0;s<this.length;s++){var o=this[s][0];"number"==typeof o&&(i[o]=!0)}for(s=0;s<t.length;s++){var r=t[s];"number"==typeof r[0]&&i[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}},102:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Carousel=void 0;var i=n(103),s=function(t){return t&&t.__esModule?t:{default:t}}(i);e.Carousel=s.default},103:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),n(104);e.default={name:"w-carousel",props:{loop:{type:Boolean,default:!0},auto:{type:Number,default:3e3},indicators:{type:Boolean,default:!1},responsive:{type:Number,default:40},flickThreshold:{type:Number,default:.6},delta:{type:Number,default:100},onSlidEnd:{type:Function,default:function(t){return 0}},preventDefault:{type:Boolean,default:!1},active:{type:Number,default:0}},data:function(){return{touch:!1,timer:0,activeIndex:this.active,trackStyle:{transform:"translate(0px, 0px) translateZ(0px)",transitionDuration:0},transitionDuration:300,width:"100vw"}},computed:{computedAuto:function(){return this.auto&&this.$slots.default.length>1},computedLoop:function(){return this.$slots.default.length>1&&this.loop}},methods:{setHelperDOM:function(){var t=this.$slots.default.length;t>1&&this.loop&&(this.addonBefore=this.list[t-1].$el.outerHTML,this.addonAfter=this.list[0].$el.outerHTML)},slid:function(t,e){var n=this.computedLoop,i=this.width,s=this.transitionDuration,o=this.$slots,r=o.default.length;if(0!==r){n||(t=(t+r)%r);var a=-i*(t+(n?1:0))-e;this.trackStyle={transform:"translate("+a+"px, 0px) translateZ(0px) translate3d(0, 0, 0)",transitionDuration:s+"ms","-webkit-backface-visibility":"hidden"},this.activeIndex=(t+r)%r,s>0&&n&&(0===this.activeIndex||this.activeIndex===r-1)&&setTimeout(this.correctIndex,s),s>0&&this.onSlidEnd(this.activeIndex)}},correctIndex:function(){this.transitionDuration=0,this.slid(this.activeIndex,0)},calculatePos:function(t){var e=t.changedTouches[0].clientX,n=t.changedTouches[0].clientY,i=this.x-e,s=this.y-n;return{deltaX:i,deltaY:s,absX:Math.abs(i),absY:Math.abs(s)}},setTimer:function(){var t=this,e=this.auto,n=this.$slots,i=n.default.length;e&&i>1&&(this.timer=setInterval(function(){t.transitionTo(t.activeIndex+1)},e))},clearTimer:function(){this.timer&&clearInterval(this.timer)},transitionTo:function(t,e){this.clearTimer(),this.transitionDuration=e||300,this.slid(t,0),this.setTimer()},onTouchstart:function(t){if(!(t.touches.length>1)){if(1===this.$slots.default.length)return void(this.touch=!1);this.touch=!0,this.transitionDuration=0,this.start=Date.now(),this.x=t.touches[0].clientX,this.y=t.touches[0].clientY,this.clearTimer()}},onTouchmove:function(t){if(this.preventDefault&&t.preventDefault(),this.touch){var e=this.calculatePos(t);e.absX>e.absY&&(t.preventDefault(),this.slid(this.activeIndex,e.deltaX))}},onTouchend:function(t){if(this.touch){var e=this.loop,n=this.$slots,i=this.start,s=this.flickThreshold,o=this.delta,r=this.activeIndex,a=this.calculatePos(t),u=Date.now()-i,c=Math.sqrt(a.absX*a.absX+a.absY*a.absY)/u,l=c>s,h=r;(l||a.absX>o)&&(h+=a.absX/a.deltaX,e||(h=Math.max(Math.min(h,n.default.length-1),0))),this.transitionTo(h),this.cleanTouch()}},onTouchcancel:function(t){this.touch&&(this.transitionTo(this.activeIndex),this.cleanTouch())},cleanTouch:function(){this.touch=!1},resize:function(){this.$nextTick(function(){this.width=this.$el.clientWidth,this.slid(this.activeIndex,0)},this)}},watch:{auto:function(){this.setTimer()}},render:function(t){var e=this,n=this.computedLoop,i=this.$slots,s=i.default.length-1,o=this.indicators&&t("div",{class:"carousel-indicators"},[" ",this.$slots.default.map(function(n,i){var s={"carousel-dot":!0,active:i===e.activeIndex};return t("div",{class:s,on:{click:e.transitionTo.bind(e,i,300)}},[" ",i," "])})," "]),r={};0!==this.responsive&&(r.height="0",r.paddingBottom=this.responsive+"%");var a={width:this.width+("number"==typeof this.width?"px":"")};return t("div",{class:"carousel",style:r},[t("div",{class:"carousel-track",style:this.trackStyle,on:{touchstart:this.onTouchstart,touchmove:this.onTouchmove,touchend:this.onTouchend,touchcancel:this.onTouchcancel}},[n?t("div",{class:"carousel-item",style:a},[this.$slots.default[s]]):null," ",this.$slots.default.map(function(e){return t("div",{class:"carousel-item",style:a},[e])})," ",n?t("div",{class:"carousel-item",style:a},[this.$slots.default[0]]):null," "]),o])},mounted:function(){var t=this;this.$nextTick(function(){t.resize(),window.addEventListener("resize",t.resize),t.setTimer()}),document.addEventListener("visibilitychange",function(e){(document.hidden?t.clearTimer:t.setTimer)()})},beforeDestroy:function(){window.removeEventListener("resize",this.resize),this.clearTimer()}}},104:function(t,e,n){var i=n(105);"string"==typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);n(2)("ebc587c4",i,!1,{})},105:function(t,e,n){e=t.exports=n(1)(!1),e.push([t.i,".carousel {\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n width: 100%;\n overflow: hidden;\n position: relative;\n}\n.carousel .carousel-track {\n height: 100%;\n min-width: 100%;\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n display: table-cell;\n font-size: 0;\n}\n.carousel .carousel-item {\n width: 100vw;\n height: 100%;\n overflow: hidden;\n display: inline-block;\n}\n.carousel .carousel-indicators {\n position: absolute;\n height: 0;\n bottom: 40px;\n left: 0;\n width: 100%;\n text-align: center;\n}\n.carousel .carousel-dot {\n display: inline-block;\n width: 20px;\n height: 20px;\n margin: 10px;\n background: rgba(0, 0, 0, .5);\n}\n.carousel .carousel-dot.active {\n background: red;\n}\n",""])},2:function(t,e,n){function i(t){for(var e=0;e<t.length;e++){var n=t[e],i=l[n.id];if(i){i.refs++;for(var s=0;s<i.parts.length;s++)i.parts[s](n.parts[s]);for(;s<n.parts.length;s++)i.parts.push(o(n.parts[s]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{for(var r=[],s=0;s<n.parts.length;s++)r.push(o(n.parts[s]));l[n.id]={id:n.id,refs:1,parts:r}}}}function s(){var t=document.createElement("style");return t.type="text/css",h.appendChild(t),t}function o(t){var e,n,i=document.querySelector("style["+b+'~="'+t.id+'"]');if(i){if(p)return v;i.parentNode.removeChild(i)}if(g){var o=f++;i=d||(d=s()),e=r.bind(null,i,o,!1),n=r.bind(null,i,o,!0)}else i=s(),e=a.bind(null,i),n=function(){i.parentNode.removeChild(i)};return e(t),function(i){if(i){if(i.css===t.css&&i.media===t.media&&i.sourceMap===t.sourceMap)return;e(t=i)}else n()}}function r(t,e,n,i){var s=n?"":i.css;if(t.styleSheet)t.styleSheet.cssText=y(e,s);else{var o=document.createTextNode(s),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(o,r[e]):t.appendChild(o)}}function a(t,e){var n=e.css,i=e.media,s=e.sourceMap;if(i&&t.setAttribute("media",i),m.ssrId&&t.setAttribute(b,e.id),s&&(n+="\n/*# sourceURL="+s.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var u="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!u)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var c=n(3),l={},h=u&&(document.head||document.getElementsByTagName("head")[0]),d=null,f=0,p=!1,v=function(){},m=null,b="data-vue-ssr-id",g="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n,s){p=n,m=s||{};var o=c(t,e);return i(o),function(e){for(var n=[],s=0;s<o.length;s++){var r=o[s],a=l[r.id];a.refs--,n.push(a)}e?(o=c(t,e),i(o)):o=[];for(var s=0;s<n.length;s++){var a=n[s];if(0===a.refs){for(var u=0;u<a.parts.length;u++)a.parts[u]();delete l[a.id]}}}};var y=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},3:function(t,e,n){"use strict";t.exports=function(t,e){for(var n=[],i={},s=0;s<e.length;s++){var o=e[s],r=o[0],a=o[1],u=o[2],c=o[3],l={id:t+":"+s,css:a,media:u,sourceMap:c};i[r]?i[r].parts.push(l):n.push(i[r]={id:r,parts:[l]})}return n}}});