├── .gitignore ├── README.md ├── babel.config.js ├── dist ├── clicaptcha.common.js ├── clicaptcha.common.js.map ├── clicaptcha.umd.js ├── clicaptcha.umd.js.map ├── clicaptcha.umd.min.js ├── clicaptcha.umd.min.js.map └── demo.html ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ └── refresh.png ├── components │ ├── Clicaptcha.vue │ └── index.js └── main.js ├── vue.config.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # local env files 5 | .env.local 6 | .env.*.local 7 | 8 | # Log files 9 | npm-debug.log* 10 | yarn-debug.log* 11 | yarn-error.log* 12 | 13 | # Editor directories and files 14 | .idea 15 | .vscode 16 | *.suo 17 | *.ntvs* 18 | *.njsproj 19 | *.sln 20 | *.sw? 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-clicaptcha 2 | 3 | ## 安装 4 | 5 | ### 1. 安装 vue-clicaptcha 6 | 7 | ``` 8 | npm install vue-clicaptcha 9 | ``` 10 | 11 | ### 2. 部署后端环境 12 | 13 | 移步至 [clicaptcha-server](https://github.com/hooray/clicaptcha-server) 项目 14 | 15 | ## 使用 16 | 17 | ```javascript 18 | import VueClicaptcha from 'vue-clicaptcha' 19 | VueClicaptcha({ 20 | src: 'http://localhost/clicaptcha.php', // 后端地址 21 | success: '验证成功!', // 成功提示,默认为“验证成功!” 22 | error: '未点中正确区域,请重试!', // 错误提示,默认为“未点中正确区域,请重试!” 23 | callback: () => { 24 | // 校验成功后执行后续业务 25 | } 26 | }); 27 | ``` 28 | 29 | ## 预览效果 30 | 31 | ![](https://i.loli.net/2019/07/24/5d37fa1ad6a0631208.png) 32 | ![](https://i.loli.net/2019/07/24/5d37f9e77ff5f52889.png) 33 | ![](https://i.loli.net/2019/07/24/5d37fa41a598430090.png) -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /dist/clicaptcha.umd.min.js: -------------------------------------------------------------------------------- 1 | (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["clicaptcha"]=t(require("vue")):e["clicaptcha"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"06cf":function(e,t,n){var r=n("83ab"),o=n("d1e7"),i=n("5c6c"),c=n("fc6a"),a=n("c04e"),s=n("5135"),u=n("0cfb"),f=Object.getOwnPropertyDescriptor;t.f=r?f:function(e,t){if(e=c(e),t=a(t,!0),u)try{return f(e,t)}catch(n){}if(s(e,t))return i(!o.f.call(e,t),e[t])}},"0954":function(e,t,n){var r=n("7f46");"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var o=n("499e").default;o("7e01c887",r,!0,{sourceMap:!1,shadowMode:!1})},"0a06":function(e,t,n){"use strict";var r=n("c532"),o=n("30b5"),i=n("f6b4"),c=n("5270"),a=n("4a7b");function s(e){this.defaults=e,this.interceptors={request:new i,response:new i}}s.prototype.request=function(e){"string"===typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=a(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[c,void 0],n=Promise.resolve(e);this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));while(t.length)n=n.then(t.shift(),t.shift());return n},s.prototype.getUri=function(e){return e=a(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){s.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t}))}})),r.forEach(["post","put","patch"],(function(e){s.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=s},"0cfb":function(e,t,n){var r=n("83ab"),o=n("d039"),i=n("cc12");e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},"0df6":function(e,t,n){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},1276:function(e,t,n){"use strict";var r=n("d784"),o=n("44e7"),i=n("825a"),c=n("1d80"),a=n("4840"),s=n("8aa5"),u=n("50c4"),f=n("14c3"),l=n("9263"),p=n("d039"),d=[].push,h=Math.min,m=4294967295,v=!p((function(){return!RegExp(m,"y")}));r("split",2,(function(e,t,n){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,n){var r=String(c(this)),i=void 0===n?m:n>>>0;if(0===i)return[];if(void 0===e)return[r];if(!o(e))return t.call(r,e,i);var a,s,u,f=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),h=0,v=new RegExp(e.source,p+"g");while(a=l.call(v,r)){if(s=v.lastIndex,s>h&&(f.push(r.slice(h,a.index)),a.length>1&&a.index=i))break;v.lastIndex===a.index&&v.lastIndex++}return h===r.length?!u&&v.test("")||f.push(""):f.push(r.slice(h)),f.length>i?f.slice(0,i):f}:"0".split(void 0,0).length?function(e,n){return void 0===e&&0===n?[]:t.call(this,e,n)}:t,[function(t,n){var o=c(this),i=void 0==t?void 0:t[e];return void 0!==i?i.call(t,o,n):r.call(String(o),t,n)},function(e,o){var c=n(r,e,this,o,r!==t);if(c.done)return c.value;var l=i(e),p=String(this),d=a(l,RegExp),g=l.unicode,y=(l.ignoreCase?"i":"")+(l.multiline?"m":"")+(l.unicode?"u":"")+(v?"y":"g"),b=new d(v?l:"^(?:"+l.source+")",y),x=void 0===o?m:o>>>0;if(0===x)return[];if(0===p.length)return null===f(b,p)?[p]:[];var w=0,S=0,j=[];while(S=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){s.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){s.headers[e]=r.merge(i)})),e.exports=s}).call(this,n("4362"))},"24fb":function(e,t,n){"use strict";function r(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"===typeof btoa){var i=o(r),c=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot||"").concat(e," */")}));return[n].concat(c).concat([i]).join("\n")}return[n].join("\n")}function o(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(t);return"/*# ".concat(n," */")}e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=r(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"===typeof e&&(e=[[null,e,""]]);var o={};if(r)for(var i=0;ir?"clicaptcha-clicked":""},[e._v(e._s(t))])}))],2),n("div",{staticClass:"clicaptcha-refresh-box"},[n("div",{staticClass:"clicaptcha-refresh-line clicaptcha-refresh-line-l"}),n("a",{staticClass:"clicaptcha-refresh-btn",attrs:{href:"javascript:;",title:"刷新"},on:{click:e.reset}}),n("div",{staticClass:"clicaptcha-refresh-line clicaptcha-refresh-line-r"})])]),n("div",{attrs:{id:"clicaptcha-mask"},on:{click:e.close}})])},o=[],i=(n("a15b"),n("ac1f"),n("1276"),n("bc3a")),c=n.n(i),a=n("4328"),s=n.n(a);c.a.defaults.withCredentials=!0;var u={data:function(){return{src:"",imgSrc:"",success:"验证成功!",error:"未点中正确区域,请重试!",tip:"",isCheck:!1,xy:[],text:[],callback:function(){}}},created:function(){this.loadImg()},methods:{loadImg:function(){this.imgSrc=this.src+"?"+(new Date).getTime()},setTitle:function(){this.tip="",this.text=window.$cookies.get("clicaptcha_text").split(","),this.xy=[]},record:function(e){var t=this;if(this.xy.length0?g+v:""}},"428f":function(e,t,n){var r=n("da84");e.exports=r},4328:function(e,t,n){"use strict";var r=n("4127"),o=n("9e6a"),i=n("b313");e.exports={formats:i,parse:o,stringify:r}},4362:function(e,t,n){t.nextTick=function(e){var t=Array.prototype.slice.call(arguments);t.shift(),setTimeout((function(){e.apply(null,t)}),0)},t.platform=t.arch=t.execPath=t.title="browser",t.pid=1,t.browser=!0,t.env={},t.argv=[],t.binding=function(e){throw new Error("No such module. (Possibly not yet loaded)")},function(){var e,r="/";t.cwd=function(){return r},t.chdir=function(t){e||(e=n("df7c")),r=e.resolve(t,r)}}(),t.exit=t.kill=t.umask=t.dlopen=t.uptime=t.memoryUsage=t.uvCounters=function(){},t.features={}},"44ad":function(e,t,n){var r=n("d039"),o=n("c6b6"),i="".split;e.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==o(e)?i.call(e,""):Object(e)}:Object},"44e7":function(e,t,n){var r=n("861d"),o=n("c6b6"),i=n("b622"),c=i("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[c])?!!t:"RegExp"==o(e))}},"467f":function(e,t,n){"use strict";var r=n("2d83");e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},4840:function(e,t,n){var r=n("825a"),o=n("1c0b"),i=n("b622"),c=i("species");e.exports=function(e,t){var n,i=r(e).constructor;return void 0===i||void 0==(n=r(i)[c])?t:o(n)}},4930:function(e,t,n){var r=n("d039");e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},"499e":function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var c=[];for(o=0;of)if(a=s[f++],a!=a)return!0}else for(;u>f;f++)if((e||f in s)&&s[f]===n)return e||f||0;return!e&&-1}};e.exports={includes:c(!0),indexOf:c(!1)}},"50c4":function(e,t,n){var r=n("a691"),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},5135:function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},5270:function(e,t,n){"use strict";var r=n("c532"),o=n("c401"),i=n("2e67"),c=n("2444");function a(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){a(e),e.headers=e.headers||{},e.data=o(e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]}));var t=e.adapter||c.adapter;return t(e).then((function(t){return a(e),t.data=o(t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(a(e),t&&t.response&&(t.response.data=o(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},5692:function(e,t,n){var r=n("c430"),o=n("c6cd");(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.6.5",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},"56ef":function(e,t,n){var r=n("d066"),o=n("241c"),i=n("7418"),c=n("825a");e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(c(e)),n=i.f;return n?t.concat(n(e)):t}},"5c6c":function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6547:function(e,t,n){var r=n("a691"),o=n("1d80"),i=function(e){return function(t,n){var i,c,a=String(o(t)),s=r(n),u=a.length;return s<0||s>=u?e?"":void 0:(i=a.charCodeAt(s),i<55296||i>56319||s+1===u||(c=a.charCodeAt(s+1))<56320||c>57343?e?a.charAt(s):i:e?a.slice(s,s+2):c-56320+(i-55296<<10)+65536)}};e.exports={codeAt:i(!1),charAt:i(!0)}},"684f":function(e,t){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAgCAYAAACinX6EAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjU5Njc5N0YyREY0RjExRTU5NzcxRUQ5MTc5MTZBOTMzIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjU5Njc5N0YzREY0RjExRTU5NzcxRUQ5MTc5MTZBOTMzIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NTk2Nzk3RjBERjRGMTFFNTk3NzFFRDkxNzkxNkE5MzMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NTk2Nzk3RjFERjRGMTFFNTk3NzFFRDkxNzkxNkE5MzMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz77TkG0AAACW0lEQVR42uyZ7U0DMQyGk6oDdAJEN2CDlgkKEuL33QbcJO0Gvd8ICTpB6QRlA05M0A0OB7mopHbiXJIrqESKSj+SJ6/PTmKj27ZV59wG6tyb8YDDHtsen5630EdSXmp+e6G20MX8HB5wBX3tMkLm9sV3GaGPEPgzRhjkXsRvN4K2405r7YrvG3iZQZ9CvxQu5A369f3d7W4fg84FOfggpjNffyiSLzIACDfAZQCUNUIXA4DwJHxjBJvvDQEQPzeuFAGP3dWz8oce8cbqRSTjRwgEik/G34eA2AD45Cm4maiGvsG/7bZOJD4ZnxPP7gEY82vi9wZcuQTB2NYlXrIHYMyzfJcgGNu6xNt8zgOWxGcliKlzu72LD2LqFG7v3ATxqLM3nLov8XjUHfFziOdOgRkRc1WAhpgnn4QvFc8ZYEo8ffGEkeJJfoigkN9yBrDdb9Pz0d8rX5IL7NRpW1b+MOfkzHGqe7xFevkSD4jJ5lJkgln5lAEa6/0kYgETz9zq1HzKAK/W+6JLTo9jCs/cSsKXVncs9xfxKQOsCDead7D+nHDBlWBcr3wuF3gnjiPxVRjGF8R1toHxY2EuQPKlt0EYT/Jh/FhaDyip+7lJj13hYL7DFHopnFOF8E167Kz4wneYQov5bEUI0+EHYTo6wg2nYHbeBTz9KqQkhulwMj48/Sq4JJaoIGKu0mVIOpy4IGKu0ix/4LnXm4GLCPjiUHxow4VH8Q/FB4UAcaMLKUo2uGkeHTs9FUUb3DS9/JRl8QbP2RUIf2E3qnxl8W8+CBfz9f9/h8+8fQowAGNfi+Aevj0yAAAAAElFTkSuQmCC"},"69f3":function(e,t,n){var r,o,i,c=n("7f9a"),a=n("da84"),s=n("861d"),u=n("9112"),f=n("5135"),l=n("f772"),p=n("d012"),d=a.WeakMap,h=function(e){return i(e)?o(e):r(e,{})},m=function(e){return function(t){var n;if(!s(t)||(n=o(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}};if(c){var v=new d,g=v.get,y=v.has,b=v.set;r=function(e,t){return b.call(v,e,t),t},o=function(e){return g.call(v,e)||{}},i=function(e){return y.call(v,e)}}else{var x=l("state");p[x]=!0,r=function(e,t){return u(e,x,t),t},o=function(e){return f(e,x)?e[x]:{}},i=function(e){return f(e,x)}}e.exports={set:r,get:o,has:i,enforce:h,getterFor:m}},"6eeb":function(e,t,n){var r=n("da84"),o=n("9112"),i=n("5135"),c=n("ce4e"),a=n("8925"),s=n("69f3"),u=s.get,f=s.enforce,l=String(String).split("String");(e.exports=function(e,t,n,a){var s=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,p=!!a&&!!a.noTargetGet;"function"==typeof n&&("string"!=typeof t||i(n,"name")||o(n,"name",t),f(n).source=l.join("string"==typeof t?t:"")),e!==r?(s?!p&&e[t]&&(u=!0):delete e[t],u?e[t]=n:o(e,t,n)):u?e[t]=n:c(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&u(this).source||a(this)}))},7418:function(e,t){t.f=Object.getOwnPropertySymbols},7839:function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"7a77":function(e,t,n){"use strict";function r(e){this.message=e}r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,e.exports=r},"7aac":function(e,t,n){"use strict";var r=n("c532");e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,i,c){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(i)&&a.push("domain="+i),!0===c&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},"7f46":function(e,t,n){var r=n("24fb"),o=n("1de5"),i=n("684f");t=r(!1);var c=o(i);t.push([e.i,"#clicaptcha-container[data-v-6367a51c]{width:350px;height:290px;padding:15px;border:1px solid #b1b3b8;background-color:#f5f6f7;position:fixed;z-index:10000;left:50%;top:50%;margin-left:-191px;margin-top:-161px;border-radius:10px;-webkit-box-shadow:0 0 0 1px hsla(0,0%,100%,.3) inset,0 .5em 1em rgba(0,0,0,.6);box-shadow:inset 0 0 0 1px hsla(0,0%,100%,.3),0 .5em 1em rgba(0,0,0,.6)}#clicaptcha-container .clicaptcha-imgbox[data-v-6367a51c]{position:relative}#clicaptcha-container .clicaptcha-imgbox .clicaptcha-img[data-v-6367a51c]{width:350px;height:200px;border:none}#clicaptcha-container .clicaptcha-imgbox .step[data-v-6367a51c]{position:absolute;width:20px;height:20px;line-height:20px;font-size:14px;font-weight:700;text-align:center;color:#f04848;border:3px solid #f04848;background-color:#fff;border-radius:30px;-webkit-box-shadow:0 0 10px #fff;box-shadow:0 0 10px #fff;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}#clicaptcha-container .clicaptcha-title[data-v-6367a51c]{font-family:Microsoft YaHei;height:40px;line-height:40px;font-size:14px;text-align:center;color:#333}#clicaptcha-container .clicaptcha-title span[data-v-6367a51c]{margin-left:10px;font-size:18px;font-weight:700;color:#c00}#clicaptcha-container .clicaptcha-title span.clicaptcha-clicked[data-v-6367a51c]{color:#069}#clicaptcha-container .clicaptcha-refresh-box[data-v-6367a51c]{position:relative;margin-top:10px}#clicaptcha-container .clicaptcha-refresh-line[data-v-6367a51c]{position:absolute;top:16px;width:140px;height:1px;background-color:#ccc}#clicaptcha-container .clicaptcha-refresh-line-l[data-v-6367a51c]{left:5px}#clicaptcha-container .clicaptcha-refresh-line-r[data-v-6367a51c]{right:5px}#clicaptcha-container .clicaptcha-refresh-btn[data-v-6367a51c]{display:block;margin:0 auto;width:32px;height:32px;background:url("+c+") no-repeat}#clicaptcha-container .clicaptcha-refresh-btn[data-v-6367a51c]:hover{background-position:-32px 0}#clicaptcha-mask[data-v-6367a51c]{position:fixed;z-index:9999;left:0;top:0;width:100%;height:100%;opacity:.5;background-color:#000}",""]),e.exports=t},"7f9a":function(e,t,n){var r=n("da84"),o=n("8925"),i=r.WeakMap;e.exports="function"===typeof i&&/native code/.test(o(i))},"825a":function(e,t,n){var r=n("861d");e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},"83ab":function(e,t,n){var r=n("d039");e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},"83b9":function(e,t,n){"use strict";var r=n("d925"),o=n("e683");e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},"861d":function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},8875:function(e,t,n){var r,o,i;(function(n,c){o=[],r=c,i="function"===typeof r?r.apply(t,o):r,void 0===i||(e.exports=i)})("undefined"!==typeof self&&self,(function(){function e(){var t=Object.getOwnPropertyDescriptor(document,"currentScript");if(!t&&"currentScript"in document&&document.currentScript)return document.currentScript;if(t&&t.get!==e&&document.currentScript)return document.currentScript;try{throw new Error}catch(d){var n,r,o,i=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,c=/@([^@]*):(\d+):(\d+)\s*$/gi,a=i.exec(d.stack)||c.exec(d.stack),s=a&&a[1]||!1,u=a&&a[2]||!1,f=document.location.href.replace(document.location.hash,""),l=document.getElementsByTagName("script");s===f&&(n=document.documentElement.outerHTML,r=new RegExp("(?:[^\\n]+?\\n){0,"+(u-2)+"}[^<]* 4 | 5 | 6 | 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-clicaptcha", 3 | "version": "0.2.3", 4 | "main": "./dist/clicaptcha.umd.min.js", 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "build-bundle": "vue-cli-service build --target lib --name clicaptcha ./src/components/index.js", 9 | "lint": "vue-cli-service lint" 10 | }, 11 | "dependencies": { 12 | "axios": "^0.21.1", 13 | "core-js": "^3.6.5", 14 | "node-sass": "^4.14.1", 15 | "sass-loader": "^10.0.2", 16 | "vue": "^2.6.12", 17 | "vue-cookies": "^1.7.4" 18 | }, 19 | "devDependencies": { 20 | "@vue/cli-plugin-babel": "^4.5.4", 21 | "@vue/cli-plugin-eslint": "^4.5.4", 22 | "@vue/cli-service": "^4.5.4", 23 | "babel-eslint": "^10.0.3", 24 | "eslint": "^7.8.1", 25 | "eslint-plugin-vue": "^6.2.2", 26 | "vue-template-compiler": "^2.6.12" 27 | }, 28 | "eslintConfig": { 29 | "root": true, 30 | "env": { 31 | "node": true 32 | }, 33 | "extends": [ 34 | "plugin:vue/essential", 35 | "eslint:recommended" 36 | ], 37 | "rules": {}, 38 | "parserOptions": { 39 | "parser": "babel-eslint" 40 | } 41 | }, 42 | "browserslist": [ 43 | "> 1%", 44 | "last 2 versions" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hooray/vue-clicaptcha/0b0762f53d4a94ac13b31a82138504398585afc7/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | vue-clicaptcha2 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /src/assets/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hooray/vue-clicaptcha/0b0762f53d4a94ac13b31a82138504398585afc7/src/assets/refresh.png -------------------------------------------------------------------------------- /src/components/Clicaptcha.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 101 | 102 | -------------------------------------------------------------------------------- /src/components/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueCookies from 'vue-cookies' 3 | 4 | Vue.use(VueCookies) 5 | let ClicaptchaConstructor = Vue.extend(require('./Clicaptcha.vue').default) 6 | 7 | let instance; 8 | 9 | const Clicaptcha = (options) => { 10 | options = options || {} 11 | instance = new ClicaptchaConstructor({ 12 | data: options 13 | }) 14 | instance.vm = instance.$mount() 15 | instance.dom = instance.vm.$el 16 | document.body.appendChild(instance.dom) 17 | return instance.vm 18 | } 19 | 20 | export default Clicaptcha -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | // import VueCookies from 'vue-cookies' 4 | 5 | Vue.config.productionTip = false 6 | 7 | // Vue.use(VueCookies) 8 | 9 | new Vue({ 10 | render: h => h(App) 11 | }).$mount('#app') 12 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | css: { 3 | extract: false 4 | } 5 | } --------------------------------------------------------------------------------