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

159
Visualizações
How to create custom integration code in JS for existing Vue App

I'm Rails developer and new in Vue JS framework. I created a toy Vue app for chat. I will want write integration code. This code embeded on customer website should fetch Vue app and it should add chat functionality to this website.

I'm thinking of something like below code:

<script type="text/javascript" >
   (function (srcjs) {
       window.vue_app = window.vue_app || {};
       vue_app.app_id = 'YOUR APP_ID';
       var doc = document.createElement('script');
       doc.type = 'text/javascript';
       doc.async = true;
       doc.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + srcjs;
       doc.src = srcjs;
       var s = document.getElementsByTagName('script')[0];
       s.parentNode.insertBefore(doc, s);
   })("..toy_app/api.js");
</script>

I can't find any tutorial for this example. Do somebody with many experience help me how to do it?

For easiest example I used Vue external library in pure HTML.

<!DOCTYPE html>

<html>
<head>
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
</head>
<body>



<div id="chat_app" class="colorRed">

  <span v-show="this.open">open</span>
  <div @click="toggleChatbot()" class="chatIcon">
  </div>
</div>

  <div v-show="this.open" class="chatContentContainer">
    <div class="chatHeader">Title </div>
    <div class="chatMain">
      Content
    </div>
    <div class="chatFooter">chatBot™ </div>
  </div>

</div>


<script type="text/javascript">
    

    var app = new Vue({

      el: '#chat_app',

      data: function() {
        return {
          message: 'Hello Vue!',
          open: false,
          notRead: true,
        };
      },
      

      methods: {
        openChatbot: function() {
          this.open = true;
        },
        closeChatbot: function() {
          this.open = false;
        },
        toggleChatbot: function() {
          this.open = !this.open;
          console.log('click');
          this.notRead = false;
        }
      },

      created: function(){

        var currentUrl = window.location.pathname;

        console.log(currentUrl);
      }
    });

   


</script>

<style>
 
  .colorRed {
    color: red;
  }
</style>

</body>

</html>
about 4 years ago · Juan Pablo Isaza
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