feat: 添加tocoModals全局变量

This commit is contained in:
dayjoy
2024-10-15 16:45:23 +08:00
parent f2a210ed29
commit 7d89ea3eb6
7 changed files with 10 additions and 2 deletions

View File

@@ -40,5 +40,6 @@ module.exports = {
],
globals: {
tocoRefs: true,
tocoModals: true,
},
};

View File

@@ -59,6 +59,7 @@ interface Meta {
tocoStore全局 store
tocoServices页面的请求
tocoRefs页面上所有带 id 组件的 refs
tocoModals页面上所有带 id 弹窗的 refs
```
## 目录结构

View File

@@ -16,7 +16,7 @@
},
"dependencies": {
"@ant-design/icons": "^5.3.4",
"@df/toco-ui": "^0.1.11",
"@df/toco-ui": "{{uiVersion}}",
"@reduxjs/toolkit": "^1.9.7",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",

View File

@@ -1,5 +1,8 @@
import { ModalRef } from '@df/toco-ui';
declare global {
let tocoRefs: Record<string, any>;
let tocoModals: Record<string, ModalRef<any>>;
}
interface Meta {

View File

@@ -25,5 +25,6 @@ reportWebVitals();
// global variables
(globalThis as any).tocoRefs = tocoGlobal.getRefs();
(globalThis as any).tocoModals = tocoGlobal.getModals();
export { store };

View File

@@ -14,6 +14,7 @@ const Test = (props) => {
console.log('store', tocoStore);
console.log('services', tocoServices);
console.log('refs', tocoRefs);
console.log('modals', tocoModals);
}, [navigate, props, tocoStore]);
return (

View File

@@ -1 +1,2 @@
projectName: toco
projectName: toco
uiVersion: 0.1.36