android 中的后退按钮破坏了 nativescript-vue 访问控制登录注销 [英] back button in android breaks nativescript-vue access control login logout
本文介绍了android 中的后退按钮破坏了 nativescript-vue 访问控制登录注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想出了一个 nativescript 应用程序的访问控制实现,但 android 后退按钮打破了它.
I have come up with an implementation of access control for a nativescript app but the android back button breaks it.
场景:
- 打开应用
- 按登录
- 在android中按下后退按钮(该应用将被最小化)
- 再次打开应用(您应该看到您已登录,但您看到您似乎已注销)
- 现在关闭应用程序
- 再次打开应用(您会看到您实际上已登录,但该应用程序为您显示了错误的页面)
我该如何解决这个问题?在 nativescript-vue 应用中保持登录状态的正确方法是什么?
How can I fix this issue? What is the propper way to stay logged-in in a nativescript-vue app?
这是一个游乐场示例
推荐答案
全局变量有时会发生这种情况,我无法准确跟踪如何使用函数,但有一个修补程序.
It happens sometimes with global variables, I didn't manage to track how exactly but a hot fix is to use a function.
function isLoaddedIn() {
return ApplicationSettings.getString('is_logged_in') == 'true';
}
new Vue({
render: h => h('frame', [h(isLoaddedIn() ? In : Out)])
}).$start()
这篇关于android 中的后退按钮破坏了 nativescript-vue 访问控制登录注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文