Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda