Files
mini-programs/src/app.ts
2025-08-24 16:04:31 +08:00

37 lines
766 B
TypeScript

import { Component, ReactNode } from 'react'
import './app.scss'
import './nutui-theme.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