@1milligram/frame 中文文档教程
Frame
一个在元素内包裹iframe
的React组件:
- [x] The
iframe
is only loaded when it is visible in the screen - [x] The
iframe
is resized automatically when its content resizes
由于跨域(CORS)问题,它只支持src
所属的iframe
您网站的同一域。
Usage
- Install the package:
$ npm install @1milligram/frame
- Using the
Frame
component:
import { Frame } from '@1milligram/frame';
import '@1milligram/frame/lib/styles/index.css';
<Frame url="/path/to/iframe" />;
Options
设置框架高度
出于任何原因,您想自己计算以调整框架高度:
const setFrameHeight = (doc: Document) => {
// `doc` is the document instance of the iframe content
return doc.body.scrollHeight;
};
<Frame setFrameHeight={setFrameHeight} />;
Frame
A React component that wraps an iframe
inside an element:
- [x] The
iframe
is only loaded when it is visible in the screen - [x] The
iframe
is resized automatically when its content resizes
Due to the cross domain (CORS) issue, it only supports iframe
whose src
belongs to the same domain of your site.
Usage
- Install the package:
$ npm install @1milligram/frame
- Using the
Frame
component:
import { Frame } from '@1milligram/frame';
import '@1milligram/frame/lib/styles/index.css';
<Frame url="/path/to/iframe" />;
Options
Setting the frame height
For any reason that you would like to do your own calculation to adjust the frame height:
const setFrameHeight = (doc: Document) => {
// `doc` is the document instance of the iframe content
return doc.body.scrollHeight;
};
<Frame setFrameHeight={setFrameHeight} />;
更多
你可能也喜欢
- 90crew-node-browser-history 中文文档教程
- @01js/taro-ui 中文文档教程
- @0xc/serverless-config-transformer 中文文档教程
- @0xproject/fill-scenarios 中文文档教程
- @21epub/create-parcel-react-library 中文文档教程
- @3share/3share-cli 中文文档教程
- @aaronpowell/apollo-server-logger-appinsights 中文文档教程
- @aaxis/react-native-webview 中文文档教程
- @abb92/holidates 中文文档教程
- @accalia.io/accalia-tools 中文文档教程