您现在的位置是:首页 > 前端会客厅 > 前端框架前端框架
vue 登录模块记住密码功能模块
YU到边2022-04-07【前端框架】人已围观
简介没啥好说的的直接上代码
mounted() {
let buer = window.localStorage.getItem('checked');
buer === 'true' ? this.checked = true : this.checked = false;
if (this.checked) {
let form = JSON.parse(window.localStorage.getItem('form'));
this.form = form;
}
}
login() {
let _this = this;
this.$refs.form.validate(async valid => {
if (!valid) return false
this.loading = true
try {
window.localStorage.setItem('checked', this.checked);
if (this.checked) {
let data = JSON.parse(JSON.stringify(_this.form));
window.localStorage.setItem('form', JSON.stringify(data));
}
await this.$store.dispatch('login', this.form);
} catch (error) {
}
this.loading = false
})
},
很赞哦! ()
相关文章
随机图文
-
记录vue3不能正常获取vuex的问题
原本store/index.js是这样写的,一直拿不到 const store = createStore({ state: { counter: 0 }, actions: {}, mutations: { }, modules: { -
Vue3.0为什么采用Proxy?
Vue3.0为什么采用Proxy? -
关于前端自动化
前端自动化已经成为现代Web开发的重要组成部分,它可以极大地提高开发效率、降低人为错误率和提高应用程序的质量。本篇博客将详细介绍前端自动化的技术,包括测试自动化、构建自动化、部署自动化和监控自动化。 -
为什么vue支持IE9以上的IE浏览器?
为什么vue支持IE9以上的IE浏览器?