无list元素时,控制台报错NavBar组件没有单独的键值key
给NavBar中的a标签加上单独的键值即可,如下所示:
{
this.props.isdetail?
<NavBar
mode="light"
icon={<Icon type="left" />}
onLeftClick={()=>window.history.go(-1)} //点击返回按钮返回到上一个页面
>
<a key={1} href="#/home"><Img src="logo.png" height={30} alt="logo" /></a>
</NavBar>:
<NavBar
leftContent={[this.props.isfooter?"":
<a key={2} href="#/home"><Img key="0" src="logo.png" height={30} alt="logo" /></a>,
]}
>
{ this.props.isfooter?
<a key={3} href="#/home"><Img src="logo.png" height={30} alt="logo" /></a>:
<SearchBar placeholder="搜索" maxLength={8} />
}
</NavBar>
}