vue-gecode
Version:
基于Vue2开发的获取验证码倒计时组件,高度自定义配置,可实现各种开发需求.
2 lines • 3.45 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("GeCode",[],e):"object"==typeof exports?exports.GeCode=e():t.GeCode=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},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="/dist/",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var i=function(){var t=this.$createElement;return(this._self._c||t)("span",{class:this.activeClass,on:{click:this.runtime}},[this._v("\n "+this._s(this.text)+"\n")])};i._withStripped=!0;var o={startText:"获取验证码",endText:"再次获取",totalTime:60,tickTime:1,activeClass:"isRun",computeText:function(t){return"重新获取 "+t+"s"},canTodo:function(){return!0},todo:function(){},endCallback:function(){},click:function(){},canUse:!0,noCanClass:"no-can"},r={data:function(){return{time:"",isRun:!1,isFirst:!0,firstText:"",totalTime:60,tickTime:1}},mounted:function(){console.log(this._config)},methods:{runtime:function(){var t=this,e=this._config;e.click(this.isRun),e.canUse&&!this.isRun&&e.canTodo()&&(this.isFirst=!1,this.isRun=!0,this.time=e.totalTime,e.todo(e),this.timer=setInterval(function(){t.time<=e.tickTime?t.stop(0):t.time-=e.tickTime},1e3*e.tickTime))},stop:function(t){var e=this._config;this.isRun&&e.endCallback(t,e),this.isRun=!1,clearInterval(this.timer)}},props:{config:{type:Object}},computed:{_config:function(){return Object.assign({},o,this.config||{})},text:function(){var t=this._config;return this.isFirst?t.startText:this.isRun?t.computeText(this.time):t.endText},activeClass:function(){var t=this._config;return(t.canUse?"":t.noCanClass+" ")+(this.isRun?t.activeClass:"")}}};r.options=o;var s=function(t,e,n,i,o,r,s,c){var u,a="function"==typeof t?t.options:t;if(e&&(a.render=e,a.staticRenderFns=n,a._compiled=!0),i&&(a.functional=!0),r&&(a._scopeId="data-v-"+r),s?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},a._ssrRegister=u):o&&(u=c?function(){o.call(this,this.$root.$options.shadowRoot)}:o),u)if(a.functional){a._injectStyles=u;var f=a.render;a.render=function(t,e){return u.call(e),f(t,e)}}else{var l=a.beforeCreate;a.beforeCreate=l?[].concat(l,u):[u]}return{exports:t,options:a}}(r,i,[],!1,null,null,null);s.options.__file="src/vue-gecode.vue";var c=s.exports;e.default=c;"undefined"!=typeof window&&window.Vue&&window.Vue.component("ge-code",c)}])});
//# sourceMappingURL=vue-ge-code.min.js.map