0.0.21 • Published 3 days ago

vue-iframes v0.0.21

Weekly downloads
53
License
MIT
Repository
github
Last release
3 days ago

vue-iframes

Vue.js component for creating dynamic async iframes based on Aaron Peter's article: http://www.aaronpeters.nl/blog/iframe-loading-techniques-performance?%3E#dynamic

Latest Version on NPM Software License npm npm

Requirements

Vue Support

Supports on Vue >= 2 & <3

Installation and Usage

npm install vue-iframes
yarn add vue-iframes
import Vue from 'vue'
import VueIframe from 'vue-iframes'

Vue.use(VueIframe)

Nuxt Support


  • Create ~/plugins/vue-iframes.js
import Vue from 'vue'
import VueIframe from 'vue-iframes'

Vue.use(VueIframe)

Nuxt SSR

import Vue from 'vue'
import VueIframe from 'vue-iframes/dist/vue-iframes.ssr'

Vue.use(VueIframe)

nuxt.config.js

plugins: [
    // ...
    { src: '~/plugins/vue-iframes' },
    // ...
]
plugins: [
    // ...
    { src: '~/plugins/vue-iframes', mode: 'client' },
    // ...
]

Or another short way

export default {
    // ...
    modules: ['vue-iframes/nuxt']
    // ...
}

Components

<template>
  <vue-iframe
      :src="src"
      allow="camera *; geolocation *; microphone *; autoplay *"
      frame-id="my-ifram"
      @load="onLoad"
      name="my-frame"
      width="150px"
      height="200px"></vue-iframe>
</template>

<script>
  export default {
    name: 'MyIframe',
    data: () => ({
      myIframe: null
    }),
    methods: {
      onLoad(frame) {
        this.myIframe = frame.contentWindow
      }
    }
  }
</script>

Props

PropDescriptionRequiredDefault
srcThe iframe resourcetrue
crossoriginCross originfalseanonymous
targetTarget of iframefalse_parent
classNameIframe's classfalsenull
allowIframe's allowfalse'camera ; geolocation ; microphone ; autoplay '
nameIframe's namefalse'vue-iframes'
frame-idIframe's idfalse'vue-iframes'
scrollingSet scrolling to iframefalsenull
widthSet width to iframefalsenull
heightSet height to iframefalsenull

Events

NameDescription
iframe-loadWhen the iframe is loaded
loadWhen the iframe is ready

Contributing

Pull requests are welcome, or open up an issue if you have ideas for additional functionality, new features or bugs.

Contact

Twitter @DevidCs83

0.0.21

3 days ago

0.0.20

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1-beta-11

4 years ago

0.0.1-beta-10

4 years ago

0.0.1-beta-9

4 years ago

0.0.1-beta-8

4 years ago

0.0.1-beta-7

4 years ago

0.0.1-beta-6

4 years ago

0.0.1-beta-5

4 years ago

0.0.1-beta-4

4 years ago

0.0.1-beta-3

4 years ago

0.0.1-beta-2

4 years ago

0.0.1-beta-1

4 years ago

0.0.1-beta-0

4 years ago

0.0.1

4 years ago