UNPKG

nsn-comp

Version:

NSN核心组件

42 lines (32 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HeaderTitle = void 0; var _nsnConst = require("nsn-const"); var _nsnUtil = require("nsn-util"); var _react = _interopRequireDefault(require("react")); var _umi = require("umi"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 = _nsnConst.NConst.EMPTY; if (routes) { var foundItem = routes.find(function (bc) { return _nsnUtil.NStr.isEqual(pathname, bc.path); }); title = (foundItem === null || foundItem === void 0 ? void 0 : foundItem.breadcrumbName) || _nsnConst.NConst.EMPTY; } return _react.default.createElement(_react.default.Fragment, null, title); }; var HeaderTitleConnect = (0, _umi.connect)(function (_ref) { var nsn_global = _ref.nsn_global; return { routes: nsn_global.routes }; })(HeaderTitle); exports.HeaderTitle = HeaderTitleConnect;