Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.$recaptcha is not a function" #3

Closed
WangXang opened this issue Dec 6, 2018 · 3 comments
Closed

this.$recaptcha is not a function" #3

WangXang opened this issue Dec 6, 2018 · 3 comments

Comments

@WangXang
Copy link

WangXang commented Dec 6, 2018

error: this.$recaptcha is not a function"

index.js:
############################
import Vue from 'vue'

import { sync } from 'vuex-router-sync'
// store
import store from "./store.js"
......
import { VueReCaptcha } from "vue-recaptcha-v3"
Vue.use(VueReCaptcha,{siteKey:"6LdwmHcUAAAAAH2jppzD3vcK3f7Rr8H7Krm1-TMg"})
############################
components:
this.$recaptcha("login").then((token) => {
console.log("谷歌Token:"+ token)
})

@WipeAir
Copy link
Contributor

WipeAir commented Dec 6, 2018

Hey,
this is actually intended, to wait until the reCAPTCHA is fully loaded you can use the
$recaptchaLoaded() function (See here). It will return a Promise which will be resolved as soon as reCAPTCHA is loaded.
I'll add a full example on how to use it to the readme soon.

@WangXang
Copy link
Author

WangXang commented Dec 7, 2018

Thanks, when capacchachaLoaded is loaded, recaptcha can be used, but for the user, this is not a good experience. Because it takes a long time to load (of course it depends on the network environment used)
#######################
components:
beforeMount(){
this.$store.commit('showLoadingByGobal',true)
this.body_status = false
this.$recaptchaLoaded().then(() => {
this.$recaptcha("login").then(
(token) => {
this.recaptchatoken = token
console.log("GooGle Token:"+token)
this.initDetail() // real request and get data
}
)
})
}
######################

@WipeAir
Copy link
Contributor

WipeAir commented Dec 7, 2018

That's true, but this behavoir is fully dependent on Google.

@WipeAir WipeAir closed this as completed Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants