fix: 解决通过style设置height, width不生效的bug && style优先级

fix: 解决通过style设置height, width不生效的bug && 并且style优先级高于标签height和width属性。

现在的实现是,即使不在外层设置height, width,他两也被设置成100%了,height !== void 0 成立了,在style里设置height 和 width就不生效了。
This commit is contained in:
DuLinRain 2020-09-02 15:26:50 +08:00 committed by GitHub
parent f463b0c339
commit 4673918e51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,13 +120,15 @@ export default class IFrame extends React.Component<IFrameProps, object> {
const {width, height} = this.state;
let {className, src, frameBorder, data, style} = this.props;
let tempStyle: any = {};
width !== void 0 && (tempStyle.width = width);
height !== void 0 && (tempStyle.height = height);
style = {
...tempStyle,
...style
};
width !== void 0 && (style.width = width);
height !== void 0 && (style.height = height);
return (
<iframe
className={className}