fix: show site title in document title

This commit is contained in:
chenos 2021-03-16 14:37:24 +08:00
parent 6c39ac3538
commit c6caa7aade

View File

@ -3,7 +3,7 @@ import { PageHeader, Card, Row, Col, Modal, message } from 'antd';
import './style.less'; import './style.less';
import { Helmet, useHistory } from 'umi'; import { Helmet, useHistory } from 'umi';
import { Spin } from '@nocobase/client'; import { Spin } from '@nocobase/client';
import { useRequest, useLocation } from 'umi'; import { useRequest, useModel } from 'umi';
import api from '@/api-client'; import api from '@/api-client';
import View from '../View'; import View from '../View';
import get from 'lodash/get'; import get from 'lodash/get';
@ -11,6 +11,8 @@ import { markdown } from '@/components/views/Field';
export function Page(props: any) { export function Page(props: any) {
const { currentRowId, pageName, children, ...restProps } = props; const { currentRowId, pageName, children, ...restProps } = props;
const { initialState = {}, refresh, setInitialState } = useModel('@@initialState');
const siteTitle = get(initialState, 'systemSettings.title') || 'NocoBase';
const { data = {}, loading, error } = useRequest(() => api.resource('menus').getInfo({ const { data = {}, loading, error } = useRequest(() => api.resource('menus').getInfo({
resourceKey: pageName, resourceKey: pageName,
@ -33,7 +35,7 @@ export function Page(props: any) {
return ( return (
<div> <div>
<Helmet> <Helmet>
<title>{data.title}</title> <title>{data.title} - {siteTitle}</title>
</Helmet> </Helmet>
<PageHeader <PageHeader
title={data.title} title={data.title}