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

View File

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

View File

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