fix: 删除无效文件

This commit is contained in:
NICE CODE BY DEV 2024-03-22 09:14:43 +08:00
parent 6e32e2a23b
commit ee25cb5e30
10 changed files with 16 additions and 32 deletions

0
config/config.ts Normal file
View File

View File

@ -1,20 +1,12 @@
import { initGlobalState, MicroAppStateActions } from '@umijs/max'; import { useState } from 'react';
const state = { export default function useQiankunStateForSlave() {
num: 1, const [globalState, setGlobalState] = useState<any>({
}; fatherName: 'zhst',
});
// 初始化 state return {
const actions: MicroAppStateActions = initGlobalState(state); globalState,
setGlobalState,
actions.onGlobalStateChange((state, prev) => { };
// state: 变更后的状态; prev 变更前的状态 }
console.log('主应用检测到state变更', state, prev);
});
// 你还可以定义一个获取state的方法下发到子应用
actions.getGlobalState = function () {
return state;
};
export default actions;

View File

@ -1,5 +1,5 @@
import doRequest from '@/utils/request'; import doRequest from '@/utils/request';
import { useState } from 'react'; import useFatherAction from './actions';
// 运行时配置 // 运行时配置
export async function getInitialState(): Promise<{ export async function getInitialState(): Promise<{
@ -13,17 +13,7 @@ export async function getInitialState(): Promise<{
} }
// 给子应用暴露的方法 // 给子应用暴露的方法
export function useQiankunStateForSlave() { export const useQiankunStateForSlave = useFatherAction;
const [globalState, setGlobalState] = useState<any>({
slogan: 'qiankun father',
useLogin: false,
});
return {
globalState,
setGlobalState,
};
}
const hostname = location.hostname; const hostname = location.hostname;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 921 KiB

View File

@ -1,3 +1,4 @@
import React from 'react';
export default function HomePage() { export default function HomePage() {
return ( return (
@ -5,4 +6,4 @@ export default function HomePage() {
<h2>error</h2> <h2>error</h2>
</div> </div>
); );
} }

View File

@ -1,8 +1,9 @@
import React from 'react';
export default function HomePage() { export default function HomePage() {
return ( return (
<div> <div>
<h2>Yay! Welcome to umi!</h2> <h2>welcome home !</h2>
</div> </div>
); );
} }