切换主题
类似 Vue 中的路由守卫 (路由的生命周期)
Vue
const location = useLocation(); useEffect( ()=> { console.log(location.pathname,"进入了路由"); return ()=> { console.log(location.pathname,"离开了路由") } }. [location.pathname])
17011bd