uni-app需要启动APP时判断登录状态,决定是否跳转到登录页时的优化
如下修改manifest.json配置文件:"app-plus" : {"usingComponents" : true,"nvueCompiler" : "uni-app","compilerVersion" : 3,"splashscreen" : {"alwaysShowBeforeRender" : false,"waiting" : true,
·
如下修改manifest.json配置文件:
"app-plus" : {
"usingComponents" : true,
"nvueCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : false,
"waiting" : true,
"autoclose" : false,
"delay" : 0
},
...
APP.vue文件中,在判断是否需要登录的位置加入关闭启动界面方法:
uni.reLaunch({
url: "/pages/login/login",
success: () => {
//#ifdef APP-PLUS
setTimeout(() => {
//#ifdef APP-PLUS
plus.navigator.closeSplashscreen();
// #endif
}, 1000)
// #endif
}
})
这样可以解决先进入首页再跳转到登录页的问题,尤其是在低端机型上,各位可以试一试。
更多推荐
所有评论(0)