【发布时间】:2022-09-28 04:22:08
【问题描述】:
我试图在我的 JSX 中传递从组件返回的 iframe 标记。 allow=\"...\" 似乎作为字符串工作,但 style=\"....\" 给出了 JSX 错误,需要映射,而不是字符串。
return(
<Rnd
style={style.casualGameContainer}
default={{
x: 10,
y: 10,
width: 810,
height: 610,
zIndex: 21,
}}
>
<iframe id=\"iframe\" title={gameInfo.name} name={gameInfo.name} src={gameInfo.url}
allow=\"display-capture;camera;microphone;fullscreen;payment;\"
referrerpolicy=\"\" frameborder=\"0\" width=\"100%\" height=\"100%\"
style={{zIndex:\'21\', border:\'1px,solid,white\'}}>
</iframe>
</Rnd>
);
const style = StyleSheet.create({
casualGameContainer: {
width: \'100%\',
height: \'74.12%\',
flexDirection: \'row\',
zIndex: \'200\',
},
以上通过 zIndex(将其转换为 z-index: 21)但不通过边界。 并且 z-index 在 iframe 中没有影响。 (并且 z-index 也没有传递给 Rnd 元素。
编辑: 事实证明 Rnd 不能接受样式表。我不得不更改为一个对象:
const style = {
width: \'100%\',
height: \'74.12%\',
flexDirection: \'row\',
zIndex: \'21\',
};
标签: css reactjs iframe react-native-stylesheet