mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 20:07:33 -07:00
Fix bug
This commit is contained in:
parent
8d233fa1cf
commit
2dd0094a95
1 changed files with 12 additions and 3 deletions
|
@ -23,7 +23,7 @@ export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
sitekey: {
|
sitekey: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -37,13 +37,22 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
if (window.hcaptcha) {
|
if (window.hcaptcha) { // loaded
|
||||||
this.available = true;
|
this.available = true;
|
||||||
} else {
|
} else {
|
||||||
|
const alreadyLoading = document.getElementById('hcaptcha');
|
||||||
|
|
||||||
|
if (alreadyLoading) { // loading
|
||||||
|
alreadyLoading.addEventListener('load', () => this.available = true);
|
||||||
|
|
||||||
|
return;
|
||||||
|
} // init
|
||||||
|
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.addEventListener('load', () => this.available = true);
|
script.addEventListener('load', () => this.available = true);
|
||||||
script.src = 'https://hcaptcha.com/1/api.js?render=explicit';
|
|
||||||
script.async = true;
|
script.async = true;
|
||||||
|
script.id = 'hcaptcha';
|
||||||
|
script.src = 'https://hcaptcha.com/1/api.js?render=explicit';
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue