提交 f34b48d2 authored 作者: 王绍森's avatar 王绍森

NavBarDiy组件

上级 a2b20758
import React from 'react';
import PropTypes from 'prop-types';
import { NavBar, Icon, } from 'antd-mobile';
import { withRouter } from 'dva/router';
/**
* 页面顶部返回条
* @prop {String|ReactNode} title 中间文字内容
* @prop {String|ReactNode} rightContent 右边文字内容
* @prop {Function} onLeftClick 左边返回图标点击事件,默认执行返回操作
*/
function NavBarDiy ({ history, title, rightContent, onLeftClick }) {
return (
<NavBar
mode="light"
icon={<Icon type="left" />}
onLeftClick={ onLeftClick ? onLeftClick : () => history.goBack()}
rightContent={rightContent}
>
<span>
{title}
</span>
</NavBar>
);
}
NavBarDiy.propTypes = {
title: PropTypes.string.isRequired,
rightContent: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
onLeftClick: PropTypes.func,
}
export default (withRouter(NavBarDiy));
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论