@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} />;
更多
你可能也喜欢
- 3d-image 中文文档教程
- 6nimmt-utils 中文文档教程
- @0x/contracts-utils 中文文档教程
- @21epub/matomo-echarts-components 中文文档教程
- @33cn/chain33errori18n 中文文档教程
- @352inc/react-bootstrap-table2-paginator 中文文档教程
- @3test/ethereum-xcert-contracts 中文文档教程
- @3yourmind/sass-node-modules-importer 中文文档教程
- @8base/permissions-provider 中文文档教程
- @abdt/cra-template 中文文档教程