react读取iframe html,GitHub - svenanders/react-iframe: Simple solution for using iframes in React

React Iframe

Simple React component for including an iframed page.

392c38cae285787f189dad3875d7fe88.png

The component is fully typescript-supported.

Usage

import Iframe from 'react-iframe'

width="450px"

height="450px"

id="myId"

className="myClassname"

display="initial"

position="relative"/>

Properties

url (required) - string the iframe url.

all other attributes are optional

src - string if set, overrides url.

scrolling - string not set if if not provided (deprecated in HTML5).

overflow - string default to "hidden".

loading - string (not added to DOM if not provided).

frameBorder - number default to "0" (deprecated in HTML5).

position - string (not added to DOM if not provided).

id - string if set, adds the id parameter with the given value.

className - string if set, adds the class parameter with the given value.

display - string defaults to "block"

height - string (1px > any number above 0, or 1% to 100%)

width - string (1px > any number above 0, or 1% to 100%)

allowFullScreen - if set, applies the allowFullScreen param (deprecated in HTML5). If set, adds allow="fullscreen".

sandbox - add optional sandbox values ("allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation")

allow - add optional allow values ("geolocation microphone camera midi encrypted-media & more")

styles - add any additional styles here. Will (intentionally) override any of the props

above. For instance:

position="absolute"

width="100%"

id="myId"

className="myClassname"

height="100%"

styles={{height: "25px"}}/>

will set the height to 25px even though it was specified as 100% in the props.

A comprehensive overview of the iframe element is available from the MDN web docs.

Development

All source code resides in the src/ folder. The other code paths are generated by the tsc compiler.

When to use

This project provides a convenient TypeScript-enabled wrapper around the native HTML tag. You can achieve the same functionality with the native tag. You do not need to use TypeScript in your project to consume this library.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值