import { v4 } from 'uuid'; import debounce from 'lodash.debounce'; // var script = { name: 'VueIframe', props: { src: { type: String, required: true }, crossorigin: { type: String, default: 'anonymous' }, target: { type: String, default: '_parent' }, className: { type: String, required: false }, allow: { type: String, default: 'camera *; geolocation *; microphone *; autoplay *' }, name: { type: String, default: 'vue-iframes' }, frameId: { type: String, default: 'vue-iframes' }, scrolling: String, width: [String, Number], height: [String, Number] }, data () { return { iframeEl: {}, iframeLoadedMessage: `IFRAME_LOADED_${v4()}`, iframeOnReadyStateChangeMessage: `IFRAME_ON_READ_STATE_CHANGE_${v4()}` }; }, methods: { removeIframe () { while (this.$el.firstChild) { this.$el.removeChild(this.$el.firstChild); } }, setIframeUrl () { if(!this.iframeEl.contentWindow) { this.initIframe(); } this.$nextTick(() => { const iframeDoc = this.iframeEl.contentWindow.document; iframeDoc.open() .write(`