先前曾写道“找不到函数grecaptcha.render”,试图对其进行修复
init:function(){
var el = this.element.get(0);
var self = this;
setTimeout(function() {
if (typeof grecaptcha === 'undefined') {
self.init();
} else {
self.grecaptcha = grecaptcha.render(el, {
sitekey: self.options.key,
callback: self.callbackResponse.bind(self)
});
}
}, 100);
this.input = $('<input>').attr({
name: this.options.name,
type: 'hidden'
});
this.input.appendTo(this.element);
var reset = $('#' + $(el).attr('id') + '-reset');
if (reset.length) {
reset.click(this.reset.bind(this));
}
}