37 lines
766 B
TypeScript
37 lines
766 B
TypeScript
import { Component, ReactNode } from 'react'
|
|
import './nutui-theme.scss'
|
|
import './app.scss'
|
|
import { useDictionaryStore } from './store/dictionaryStore'
|
|
|
|
interface AppProps {
|
|
children: ReactNode
|
|
}
|
|
|
|
class App extends Component<AppProps> {
|
|
componentDidMount() {
|
|
// 初始化字典数据
|
|
this.initDictionaryData()
|
|
}
|
|
|
|
componentDidShow() {}
|
|
|
|
componentDidHide() {}
|
|
|
|
// 初始化字典数据
|
|
private async initDictionaryData() {
|
|
try {
|
|
const { fetchDictionary } = useDictionaryStore.getState()
|
|
await fetchDictionary()
|
|
} catch (error) {
|
|
console.error('初始化字典数据失败:', error)
|
|
}
|
|
}
|
|
|
|
render() {
|
|
// this.props.children 是将要会渲染的页面
|
|
return this.props.children
|
|
}
|
|
}
|
|
|
|
export default App
|