cartodb-4.42/lib/assets/javascripts/new-dashboard/components/InjectableIframe.vue

31 lines
571 B
Vue
Raw Normal View History

2024-04-06 13:25:13 +08:00
<template>
<iframe ref="iframe" frameborder="0" :height="height" :width="width"></iframe>
</template>
<script>
export default {
name: 'InjectableIframe',
mounted () {
this.setContent();
},
props: {
content: String,
height: String,
width: String
},
methods: {
setContent () {
const docIframe = this.$refs.iframe.contentWindow.document;
docIframe.open('text/html', 'replace');
docIframe.write(this.content);
docIframe.close();
}
},
watch: {
content () {
this.setContent();
}
}
};
</script>