# Iframe Tab

You can open external websites with iframe tabs.

WARNING

This feature requires RouterTabRoutes from RouterTab. See Essentials - Route Config

# Iframe Tab Operation

# Open iframe Tab

// the arguments are url, tab title and icon
this.$tabs.openIframe('https://vuejs.org', 'Vue.js', 'icon-web')
1
2

# Close iframe Tab

this.$tabs.closeIframe('https://vuejs.org')
1

# Refresh iframe Tab

this.$tabs.refreshIframe('https://vuejs.org')
1

# Iframe Tab Events

Supported iframe tab events are listed below:

  • iframe-mounted

  • iframe-loaded

Note that url jumping within iframe will also trigger iframe-loaded event.

Example:

<template>
  <router-tab @iframe-mounted="iframeMounted" @iframe-loaded="iframeLoaded" />
</template>

<script>
export default {
  methods: {
    // iframe 节点挂载就绪
    iframeMounted(url, iframe) {
      console.log('iframe-mounted:', url, iframe.contentWindow)
    },

    // iframe 内容加载成功
    iframeLoaded(url, iframe) {
      console.log('iframe-loaded:', url, iframe.contentWindow)
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Last updated: 9/27/2020, 2:16:26 AM