captcha.js
669 Bytes
import $ from 'jquery';
const url = 'https://ssl.captcha.qq.com/TCaptcha.js';
function _initScript() {
return $.getScript(url);
}
const store = {
appId: '',
open: 0
};
export default {
init() {
let $tencentCaptcha = $('.yoho-tencentCaptcha');
store.appId = $tencentCaptcha.data('appid');
store.open = Number($tencentCaptcha.data('open'));
if (store.appId) {
return _initScript();
}
return $.Deferred().resolve();
},
isOn() {
return store.open;
},
getInstance(cb) {
console.log(store);
return new TencentCaptcha(store.appId+'', cb, {});
}
};