1封装NavHeader组件实现城市选择 地图找房页面的复用
2在component目录中创建NavHeader/index.js
import React from 'react'
import { NavBar } from 'antd-mobile'
export default function NavHeader({children}) {
return (
<NavBar
className="navbar"
mode="light"
icon={<i className="iconfont icon-back" />}
onLeftClick={() => this.props.histoty.push.go(-1)}
// 导航栏右边内容
// rightContent={[
// <Icon
// key="0"
// type="search"
// style={{ marginRight: '16px' }}
// />,
// <Icon key="1" type="ellipsis" />,
// ]}
>
{children}
</NavBar>
)
}
总结
标签:封装,154,顶部,组件,NavHeader,导航,children From: https://blog.51cto.com/u_15460007/6049551