Quasar 1 Recaptcha v2

 avatar
unknown
html
2 years ago
732 B
5
Indexable
<template>
  <q-page class="flex flex-center">
    <div>
      <div id="g-recaptcha"></div>
    </div>
  </q-page>
</template>

<script>
export default {
  name: "PageIndex",
  mounted() {
    let recaptchaScript = document.createElement("script");
    recaptchaScript.setAttribute(
      "src",
      "https://www.google.com/recaptcha/api.js"
    );
    document.head.appendChild(recaptchaScript);

    setTimeout(() => {
      window.grecaptcha.render("g-recaptcha", {
        sitekey: "6LcnmAAkAAAAAFx6N74Rt3QUUb9HAhb4n8bnmda1",
        callback: this.verifyRecaptcha,
      });
    }, 200);
  },
  methods: {
    verifyRecaptcha(response) {
      console.log(response);
    },
  },
};
</script>
Editor is loading...