feat: 添加tocoModals全局变量
This commit is contained in:
@@ -40,5 +40,6 @@ module.exports = {
|
||||
],
|
||||
globals: {
|
||||
tocoRefs: true,
|
||||
tocoModals: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -59,6 +59,7 @@ interface Meta {
|
||||
tocoStore:全局 store
|
||||
tocoServices:页面的请求
|
||||
tocoRefs:页面上所有带 id 组件的 refs
|
||||
tocoModals:页面上所有带 id 弹窗的 refs
|
||||
```
|
||||
|
||||
## 目录结构
|
||||
|
||||
@@ -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",
|
||||
|
||||
3
template/src/global.d.ts
vendored
3
template/src/global.d.ts
vendored
@@ -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 {
|
||||
|
||||
@@ -25,5 +25,6 @@ reportWebVitals();
|
||||
|
||||
// global variables
|
||||
(globalThis as any).tocoRefs = tocoGlobal.getRefs();
|
||||
(globalThis as any).tocoModals = tocoGlobal.getModals();
|
||||
|
||||
export { store };
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
projectName: toco
|
||||
projectName: toco
|
||||
uiVersion: 0.1.36
|
||||
Reference in New Issue
Block a user