question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello all,

I’ve been trying to get this to work in a tsx file. I cannot seem to find the right place to put the google javascript script tag and have it load. If I add it to the index.html then it loads before vue and give me an error it cannot find the onload callback. If I put it in the tsx then webpack cannot load correctly.

Are there any examples or advice on how to get this to work?

Cheers,

James

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Stoomcommented, Mar 13, 2018

The following is my solutions using a mixin

import { Component as Mixin, Vue } from 'vue-property-decorator';

@Mixin({
  mounted: () => {
    const script = document.createElement('script');
    script.src = 'https://www.google.com/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit';
    script.async = true;
    script.defer = true;

    document.body.appendChild(script);
  },
})
export default class GoogleRecaptchaMixin extends Vue { }
0reactions
stale[bot]commented, Jun 14, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - JSX - TypeScript
JSX is an embeddable XML-like syntax. It is meant to be transformed into valid JavaScript, though the semantics of that transformation are ...
Read more >
How to use TypeScript with React: A tutorial with examples
tsx files. In this tutorial, you'll learn everything you need to know about using TypeScript in your React projects. You'll also learn why...
Read more >
Introducing JSX - React
In the example below, we declare a variable called name and then use it inside JSX by wrapping it in curly braces: const...
Read more >
Working of JSX in TypeScript | Examples - eduCBA
This is a guide to TypeScript JSX. Here we discuss the introduction, working of JSX in TypeScript along with examples respectively.
Read more >
TSX and ES6 - WebStorm Guide - JetBrains
TSX and ES6. Using React and TypeScript means good JSX and ES6+ support in the IDE. This section shows some useful features from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found