This commit is contained in:
IndieKKY
2023-05-17 16:37:56 +08:00
commit 858f83a45c
59 changed files with 8855 additions and 0 deletions

26
src/Router.tsx Normal file
View File

@@ -0,0 +1,26 @@
import App from './App'
import {useEventEmitter} from 'ahooks'
import React from 'react'
export const EventBusContext = React.createContext<any>(null)
const map: { [key: string]: string } = {
// '/close': 'close',
}
const Router = () => {
const path = map[window.location.pathname] ?? 'app'
if (path === 'close') {
window.close()
}
// 事件总线
const eventBus = useEventEmitter()
return <EventBusContext.Provider value={eventBus}>
{path === 'app' && <App/>}
</EventBusContext.Provider>
}
export default Router