feat: support document title

This commit is contained in:
chenos 2020-12-19 15:48:56 +08:00
parent 5fdbc1b10d
commit ddcf0f4219
6 changed files with 23 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import { defineConfig } from 'umi'; import { defineConfig } from 'umi';
export default defineConfig({ export default defineConfig({
title: false,
nodeModulesTransform: { nodeModulesTransform: {
type: 'none', type: 'none',
}, },

View File

@ -3,6 +3,7 @@ import ViewFactory from '@/components/views';
import { PageHeader, Tabs, Button, Statistic, Descriptions } from 'antd'; import { PageHeader, Tabs, Button, Statistic, Descriptions } from 'antd';
import { useRequest, request, Spin } from '@nocobase/client'; import { useRequest, request, Spin } from '@nocobase/client';
import { getPathName } from './utils'; import { getPathName } from './utils';
import { Helmet } from 'umi';
export function CollectionIndex(props) { export function CollectionIndex(props) {
const { lastPage } = props; const { lastPage } = props;
@ -11,6 +12,9 @@ export function CollectionIndex(props) {
return ( return (
<div> <div>
<Helmet>
<title>{title}</title>
</Helmet>
<PageHeader <PageHeader
ghost={false} ghost={false}
title={title} title={title}

View File

@ -5,6 +5,7 @@ import { getPathName, redirectTo } from './utils';
import api from '@/api-client'; import api from '@/api-client';
import { useRequest } from 'umi'; import { useRequest } from 'umi';
import { Spin } from '@nocobase/client'; import { Spin } from '@nocobase/client';
import { Helmet } from 'umi';
export function CollectionSingle(props) { export function CollectionSingle(props) {
console.log(props); console.log(props);
@ -26,6 +27,9 @@ export function CollectionSingle(props) {
} }
return ( return (
<div> <div>
<Helmet>
<title>{data.pageTitle}</title>
</Helmet>
<PageHeader <PageHeader
ghost={false} ghost={false}
onBack={() => { onBack={() => {

View File

@ -1,12 +1,17 @@
import React from 'react'; import React from 'react';
import { PageHeader } from 'antd'; import { PageHeader } from 'antd';
import './style.less'; import './style.less';
import { Helmet } from 'umi';
export function Page(props: any) { export function Page(props: any) {
const { children, ...restProps } = props; const { title, children, ...restProps } = props;
return ( return (
<div> <div>
<Helmet>
<title>{title}</title>
</Helmet>
<PageHeader <PageHeader
title={title}
ghost={false} ghost={false}
{...restProps} {...restProps}
/> />

View File

@ -2,10 +2,14 @@ import React from 'react';
import { Link } from 'umi'; import { Link } from 'umi';
import { Page } from '@/components/pages'; import { Page } from '@/components/pages';
import ViewFactory from '@/components/views'; import ViewFactory from '@/components/views';
import { Helmet } from 'umi';
export default (props: any) => { export default (props: any) => {
return ( return (
<div> <div>
<Helmet>
<title>{'登录 NocoBase'}</title>
</Helmet>
<ViewFactory <ViewFactory
{...props} {...props}
viewName={'login'} viewName={'login'}

View File

@ -2,10 +2,14 @@ import React from 'react';
import { Link } from 'umi'; import { Link } from 'umi';
import { Page } from '@/components/pages'; import { Page } from '@/components/pages';
import ViewFactory from '@/components/views'; import ViewFactory from '@/components/views';
import { Helmet } from 'umi';
export default (props: any) => { export default (props: any) => {
return ( return (
<div> <div>
<Helmet>
<title>{'注册 NocoBase'}</title>
</Helmet>
<ViewFactory <ViewFactory
{...props} {...props}
viewName={'register'} viewName={'register'}