vue实现记住用户名和密码

		mounted() {
    
    
            let account = localStorage.getItem('account');
            let pwd = localStorage.getItem('pwd');
            if (account){
    
    
                this.account = account;
                this.pwd = pwd;
                this.checked = true
            }
        },
        methods: {
    
    
            login() {
    
    
                if (this.checked == true) {
    
    
                    localStorage.setItem('account', this.account);
                    localStorage.setItem('pwd', this.pwd);
                }
            }
        }

猜你喜欢

转载自blog.csdn.net/zhouqi1427/article/details/114005787