我有一个反应项目,我有一个横幅库,我使用反应路由器4在不同的客户,年和活动之间导航
<BrowserRouter>
<div>
<Switch>
<Route path="/:client/:year/:campaign/:banner" exact component={bannerPage} />
<Route path="/:client/:year/:campaign" exact component={campaignPage} />
<Route path="/:client/:year" exact component={campaignIndex} />
<Route path="/" exact component={clientIndex} />
</Switch>
</div>
</BrowserRouter>
Run Code Online (Sandbox Code Playgroud)
在显示特定横幅的组件上,我有一个i帧来渲染实际横幅而没有别的
render() {
return(
<div>
<iframe src='data/client/year/campaign/banner'
width="300px"
height="250px"
display="initial" >
</iframe>
</div>
)
}
Run Code Online (Sandbox Code Playgroud)
但当我尝试渲染横幅时,React Router拦截iframe的src并再次显示index.html页面,没有任何组件,因为路径与任何路径都不匹配
任何帮助,将不胜感激!谢谢!