D
D
dicem2021-08-12 18:16:02
Vue.js
dicem, 2021-08-12 18:16:02

How to insert a script into a Vue app?

The bottom line is, there is a script from amocrm with all sorts of social buttons, it looks something like this:

<script>(function(a,m,o,c,r,m){a[m]={id:"........",hash:".................",locale:"ru",inline:true,setMeta:function(p){this.params=(this.params||[]).concat([p])}};a[o]=a[o]||function(){(a[o].q=a[o].q||[]).push(arguments)};var d=a.document,s=d.createElement('script');s.async=true;s.id=m+'_script';s.src='https://gso.amocrm.ru/js/button.js';d.head&&d.head.appendChild(s)}(window,0,'amoSocialButton',0,0,'amo_social_button'));</script>


How to correctly insert it into Vue application? I tried directly in index.html, through createElement, through component methods and by calling at all stages of the life cycle and errors are constantly flying, although if the same code is inserted into regular html without frameworks and run in the browser, everything works fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NM4ik, 2021-08-14
@NM4ik

Are you talking about this?
6117c46e51df8345986564.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question