fix: do not display the page title

This commit is contained in:
chenos 2022-02-11 09:42:15 +08:00
parent 7e76c54012
commit 95f4406ba9
4 changed files with 14 additions and 5 deletions

View File

@ -25,12 +25,12 @@ import { Spin } from 'antd';
import 'antd/dist/antd.css';
import React from 'react';
import { I18nextProvider } from 'react-i18next';
import { Link, MemoryRouter, NavLink } from 'react-router-dom';
import { Link, NavLink } from 'react-router-dom';
import apiClient from './apiClient';
const providers = [
// [HashRouter],
[MemoryRouter, { initialEntries: ['/'] }],
// [MemoryRouter, { initialEntries: ['/'] }],
[APIClientProvider, { apiClient }],
[I18nextProvider, { i18n }],
[AntdConfigProvider, { remoteLocale: true }],

View File

@ -3,6 +3,7 @@ import React, { useRef, useState } from 'react';
import { useHistory, useRouteMatch } from 'react-router-dom';
import {
CurrentUser,
findByUid,
findMenuItem,
PluginManager,
RemoteSchemaComponent,
@ -42,6 +43,10 @@ export function AdminLayout(props: any) {
}}
onSuccess={(data) => {
if (defaultSelectedUid) {
const s = findByUid(data?.data, defaultSelectedUid);
if (s) {
setTitle(s.title);
}
return;
}
setHidden(true);

View File

@ -1,2 +1,3 @@
export * from './Menu';
export { findMenuItem } from './util';
export * from './util';

View File

@ -1,6 +1,9 @@
import { Schema, observer, useFieldSchema, useField, RecursionField } from '@formily/react';
import { Schema } from '@formily/react';
function findByUid(schema: Schema, uid: string) {
export function findByUid(schema: Schema, uid: string) {
if (!Schema.isSchemaInstance(schema)) {
schema = new Schema(schema);
}
return schema.reduceProperties((buffter, s) => {
if (s['x-uid'] === uid) {
return s;