import router from "@/common/constants/router"; /** * 导航拦截器 */ const naviInterceptor = () => { uni.addInterceptor('navigateTo', { invoke(data) { const token = uni.getStorageSync('token'); if (!token) { uni.reLaunch({ url: router.LOGIN_URL }); return false; // 阻止跳转 } } }); }; export default naviInterceptor;