0

I'm using an SDK that renders a full screen element on the page (100% width and height). I want to restrict this. I'm using Vue.js in this project.

I tried to render inside an iframe following this demo:

Vue.component('i-frame', {

  render(h) {
    return h('iframe', {
      on: { load: this.renderChildren }
    })
  },
  beforeUpdate() {
    //freezing to prevent unnessessary Reactifiation of vNodes
    this.iApp.children = Object.freeze(this.$slots.default)
  },
  methods: {
    renderChildren() {
      const children = this.$slots.default
      const body = this.$el.contentDocument.body
      const el = document.createElement('DIV') // we will mount or nested app to this element
      body.appendChild(el)

      const iApp = new Vue({
        name: 'iApp',
        //freezing to prevent unnessessary Reactifiation of vNodes
        data: { children: Object.freeze(children) },
        render(h) {
          return h('div', this.children)
        },
      })

      iApp.$mount(el) // mount into iframe

      this.iApp = iApp // cache instance for later updates


    }
  }
})

Vue.component('test-child', {
  template: `<div>
    <h3>{{ title }}</h3>
    <p>
      <slot/>
    </p>
  </div>`,
  props: ['title'],
  methods: {
    log: _.debounce(function () {
      console.log('resize!')
    }, 200)
  },
  mounted() {
    this.$nextTick(() => {
      const doc = this.$el.ownerDocument
      const win = doc.defaultView
      win.addEventListener('resize', this.log)
    })
  },
  beforeDestroy() {
    const doc = this.$el.ownerDocument
    const win = doc.defaultView
    win.removeEventListener('resize', this.log)
  }
})

new Vue({
  el: '#app',
  data: {
    dynamicPart: 'InputContent',
    show: false,
  }
})

https://jsfiddle.net/Linusborg/ohznser9/

And read this question: Render Component in iframe using vuejs without src attribute

But nothing restricts this behavior. The SDK in question is the Zoom Web SDK

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Xinton
  • 306
  • 2
  • 7

1 Answers1

0

I think you should give it a shot using A Modal to control views and what to show. I use it for a current project to display different view I have full control over how much of the screen it should take Try this plugin Vue-js-modal. It is very nice and well documented

Salamu Hamad
  • 23
  • 1
  • 4
  • I think that will not solve my problem. Because this SDK render a video meeting and i want to add a chat on the side. But thank you for presenting this tool – Xinton May 29 '19 at 12:54