Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
Loading Plaid JS from CDN in VueJS

I'm trying to get Plaid working in VueJS but I just can't get the JS loading.

This works fine using Vanilla JS: https://jsfiddle.net/5vnh2ubs/

But this just doesn't seem to work:

<template>
  <div id="app">
    {{ pl }}
  </div>
</template>

<script>
export default {
  beforeMount() {
    this.pl = this.Plaid;
  },
  data() {
    return {
      pl: null,
    };
  },
};
</script>

I've tried importing the script in the index.html file and used vue-plugin-load-script but nothing seems to work.

I've never had this issue when loading JS files in the index.html file.

Edit:

This is how I've tried loading it using vue-plugin-load-script:

this.$loadScript('https://cdn.plaid.com/link/v2/stable/link-initialize.js')
.then(() => {
    console.log(this.Plaid);
})
.catch(() => {
    console.log('error');
});

And in index.html, it's a simple script tag between the head tags:

<script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>

I can see the script tag is there when I inspect elements but calling Plaid returns nothing.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The Plaid CDN script creates a global variable: window.Plaid. However, your component incorrectly refers to it via this.Plaid. In the Vue SFC, this is the component instance, which only contains its own properties declared in the component definition. this does not include global variables from window.

The solution is to use window.Plaid:

export default {
  data() {
    return {
      pl: window.Plaid,
    }
  }
}

demo

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda