I would like to load an external script with vue when the page loads through an API request which delivers an html script with some attributes.
<template>
<div id="content">
<h2>Some kinda monster</h2>
<iframe :srcdoc="htmlContent"></iframe>
</div>
</template>
<script>
import { mapState } from 'vuex';
export default {
computed: {
...mapState({
htmlContent: state => state.rawhtml,
}),
},
mounted() {
this.getRawHtml();
},
methods:{
getRawHtml: function() {
this.$store.dispatch("RAW_HTML").catch(function(error) {});
},
},
};
</script>
When rendering the iframe seems completely empty. When adding the html to a static page it renders fine.