import { useContext } from 'react' import AppContext from '@/contexts/AppContext' export const useAppContext = () => { const context = useContext(AppContext) if (!context) { throw new Error('useAppContext 必须在 AppContext.Provider 内使用') } return context }