0.1.8 • Published 4 years ago

pikaz-iframe v0.1.8

Weekly downloads
9
License
MIT
Repository
github
Last release
4 years ago

Introduction

基于vue封装的一个iframe插件

Features

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

demo

demo代码

Installation

With npm or yarn

yarn add pikaz-iframe

npm i -S pikaz-iframe

For Vue-cli

<pikaz-iframe :setting="setting">
</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是否显示框架周围的边框number0/10
sandbox启用iframe中内容的额外限制,传入空字符串则对所有权限做限制,具体查看MDN-iframestring""/allow-forms/allow-same-origin/allow-scripts/allow-top-navigation等传入src时默认为"allow-same-origin allow-scripts",传入srcdoc时默认为"allow-scripts"
src被嵌套的页面的 URL 地址string----
srcdochtml内容string----
hideScrolling是否隐藏滚动条,传入true默认隐藏18px宽的滚动条,如需隐藏其他宽度滚动条,则传入宽度如"20px"boolean/string--false
onloadiframe加载完成时的钩子funtion----
css传入html内容时,需修改的css样式,如"div{color:red;}"string----

更多设置选项请查看MDN-iframe

Events

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

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago