nsn-comp
Version:
NSN核心组件
30 lines (26 loc) • 889 B
JavaScript
import { NConst } from 'nsn-const';
import { NStr } from 'nsn-util';
import React from 'react';
import { connect } from 'umi';
var HeaderTitle = function HeaderTitle(props) {
var _props$routes = props.routes,
routes = _props$routes === void 0 ? [] : _props$routes;
var _window = window,
location = _window.location;
var pathname = location.pathname;
var title = NConst.EMPTY;
if (routes) {
var foundItem = routes.find(function (bc) {
return NStr.isEqual(pathname, bc.path);
});
title = (foundItem === null || foundItem === void 0 ? void 0 : foundItem.breadcrumbName) || NConst.EMPTY;
}
return React.createElement(React.Fragment, null, title);
};
var HeaderTitleConnect = connect(function (_ref) {
var nsn_global = _ref.nsn_global;
return {
routes: nsn_global.routes
};
})(HeaderTitle);
export { HeaderTitleConnect as HeaderTitle };