Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A Vue js component for creating super fast loading, non-blocking iframes.

NotificationsYou must be signed in to change notification settings

chantouchsek/vue-iframes

Repository files navigation

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 NPMSoftware Licensenpmnpm

Requirements

Vue Support

Supports on Vue >= 2 & <3

Installation and Usage

npm install vue-iframes
yarn add vue-iframes
importVuefrom'vue'importVueIframefrom'vue-iframes'Vue.use(VueIframe)

Nuxt Support


  • Create~/plugins/vue-iframes.js
importVuefrom'vue'importVueIframefrom'vue-iframes'Vue.use(VueIframe)

Nuxt SSR

importVuefrom'vue'importVueIframefrom'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

exportdefault{// ...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>exportdefault {    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

About

A Vue js component for creating super fast loading, non-blocking iframes.

Resources

Stars

Watchers

Forks

Sponsor this project

    Packages

    No packages published

    [8]ページ先頭

    ©2009-2025 Movatter.jp