UNPKG

@ozo/react-rock

Version:

React 移动端开发脚手架,基于CRA3,通用、开箱即用。

17 lines (16 loc) 445 B
/** * 获取页面title * @param {string} pathname {pathname} 从路由获取的location对象中提取pathname * @param {array} routerData routerConfig集合 * @returns {string} 页面title */ export function getPageTitle({ pathname }, routerData = []) { let title = ''; const tItem = routerData.find((item) => { return item.path === pathname; }); if (tItem) { return tItem.title; } return title; }