Giter VIP home page Giter VIP logo

pikaz-iframe's Introduction

Introduction

基于vue封装的一个iframe插件

Features

  • 带有默认设置,方便使用iframe,可设置是否隐藏滚动条,修改传入的HTML内容样式等。

Installation

With npm or yarn

yarn add pikaz-iframe

npm i -S pikaz-iframe

For Vue-cli

<pikaz-iframe :setting="setting" @onload="onload">
</pikaz-iframe>

.vue file:

  import {PikazIframe} from 'pikaz-iframe'
  ...
  export default {
        components: {
            PikazIframe,
        },
        data () {
          return {
            setting:{
              src: "https://m.baidu.com/"
            },
            onload: ()=> {
                console.log("载入成功")
            }
          }
        }
  ...

setting参数:

参数 说明 类型 可选值 默认值
frameborder 是否显示框架周围的边框 number 0/1 0
sandbox 启用iframe中内容的额外限制,传入空字符串则对所有权限做限制,具体查看MDN-iframe string ""/allow-forms/allow-same-origin/allow-scripts/allow-top-navigation等 传入src时默认为"allow-same-origin allow-scripts",传入srcdoc时默认为"allow-scripts"
src 被嵌套的页面的 URL 地址 string -- --
srcdoc html内容 string -- --
hideScrolling 是否隐藏滚动条,传入true默认隐藏18px宽的滚动条,如需隐藏其他宽度滚动条,则传入宽度如"20px" boolean/string -- false
css 传入html内容时,需修改的css样式,如"div{color:red;}" string -- --
更多设置选项请查看MDN-iframe

Events

事件名称 说明 回调参数
onload iframe加载完成时触发 --

pikaz-iframe's People

Contributors

pikaz-18 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.