Home > Mobile >  VueJs Teleport To Style - Script Tag
VueJs Teleport To Style - Script Tag

Time:10-03

I want the admin to be able to use their own custom codes on the site such as Google Analytic code. So I try to use teleport to script and style tag like this;

Index.html;

<script id="custom-js"></script>
<style id="custom-css"></style>

App.vue;

<teleport to="#custom-css" v-html="custom.css"></teleport>
<teleport to="#custom-js" v-html="custom.js"></teleport>

But it's not working. What can I do? Is there another way to do that?

CodePudding user response:

The problem in your code is v-html accepts string only, not a file path, v-html is mostly like innerHTML attribute of the DOM element.

  • Related