今天在写一个安卓的登录界面,发现缓存了密码之后,回显的时候在模拟器上不能回显
handleLogin() {
this.$refs.loginForm.validate().then(() => {
this.loading = true
this.$store.dispatch('user/login', this.form).then(res => {
//登录成功后,选中记住密码保存,否则删除
if (this.savePassword.length > 0) {
// const {}
uni.setStorageSync('loginInfo', this.form)
} else {
uni.removeStorageSync('loginInfo')
}
//登录成功后获取用户信息
this.getUserInfo()
uni.switchTab({ url: '/pages/home/index' })
}).finally(() => {
this.loading = false
})
})
},
getStoragePassword() {
const loginInfo = uni.getStorageSync('loginInfo')
if (loginInfo) {
this.form = loginInfo
if (loginInfo.savePass) {
this.savePassword.push('remember')
}
}
},
initLogin() {
this.getStoragePassword()
this.$refs.loginForm.setRules(this.rules)
}
在h5上回显没有问题,但是在安卓模拟器上不行,请问各位,这是为什么,有什么解决方案吗?求教谢谢啦!
z***@163.com
感谢熬,没想到这样就能解决了。
2024-04-10 09:42