Sunday, 26 September 2021

Loading HTML file content in a Vue component

I'm having troubles loading the content of an HTML file in a Vue component. Basically i have a Django backend that generates an HTML file using Bokeh and a library called backtesting.py. My frontend is using Nuxt/Vue, so i can't just load the HTML on the page dynamically.

Here is what the HTML file looks like (it was too long to post here): https://controlc.com/aad9cb7f

The content of that file should be loaded in a basic component:

<template>
  
  <div>
    <h1>Some content here</h1>
  </div>

</template>


<script>


export default {
    components: {

    },
    data() {
        return {
      
        }
    },

    mounted() {      
    },
    methods: {

    }
}
</script>

The problem is that i really don't know how to do that. If i just copy and paste the content in the vue component, i'll get a lot of error due to the fact that i'm using a <script> tag in a component. The only thing i managed to do was to load the BokehJS CDN in my index.html file, but even after that i'll get a Bokeh is undefined error in the component.

What can i do to accomplish this? Any kind of advice is appreciated



from Loading HTML file content in a Vue component

No comments:

Post a Comment