【问题标题】:React - Background image even if i got 3 components rendering?React - 即使我有 3 个组件渲染的背景图像?
【发布时间】:2021-03-31 21:45:18
【问题描述】:

我试图根据 API 响应更改我的应用程序的背景图像,但我需要弄清楚的第一件事是,当我有 3 个组件呈现页眉、主页和页脚时,如何让图像背景覆盖整个应用程序?

感谢任何帮助。

【问题讨论】:

  • 你能分享那段代码吗?让我们有个清晰的思路

标签: reactjs background components


【解决方案1】:
const Main = () => {

return(
<div className='background'> //set background image
//import components here

</div>

)

}

我确定您正在将它们导入到 Main/Prent 组件中。在 Parent 中的 div 中添加背景图片,并在该 div 中导入组件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-26
    • 2020-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-26
    • 2020-10-04
    • 1970-01-01
    相关资源
    最近更新 更多