2022-10-06 10:29:53 +08:00
|
|
|
# 配置中心
|
2022-09-30 12:41:23 +08:00
|
|
|
|
2022-10-31 22:41:24 +08:00
|
|
|
<img src="./settings-center/settings-tab.jpg" style="max-width: 100%;"/>
|
2022-09-30 12:41:23 +08:00
|
|
|
|
|
|
|
## 示例
|
|
|
|
|
|
|
|
```tsx | pure
|
|
|
|
import { SettingsCenterProvider } from '@nocobase/client';
|
|
|
|
import React, { useContext } from 'react';
|
|
|
|
|
|
|
|
const HelloTab => () => <div>Hello Tab</div>;
|
|
|
|
|
|
|
|
export default React.memo((props) => {
|
|
|
|
return (
|
|
|
|
<SettingsCenterProvider
|
|
|
|
settings={{
|
|
|
|
'sample-hello': {
|
|
|
|
title: 'Hello',
|
|
|
|
icon: 'ApiOutlined',
|
|
|
|
tabs: {
|
|
|
|
tab1: {
|
|
|
|
title: 'Hello Tab',
|
|
|
|
component: HelloTab,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
>{props.children}</SettingsCenterProvider>
|
|
|
|
);
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
|
|
|
完整示例查看 [samples/hello](https://github.com/nocobase/nocobase/tree/develop/packages/samples/hello)。
|