1
This commit is contained in:
22
Yes.Blog/wwwroot/admin/js/login.js
Normal file
22
Yes.Blog/wwwroot/admin/js/login.js
Normal file
@@ -0,0 +1,22 @@
|
||||
document.addEventListener('alpine:init', function () {
|
||||
Alpine.data('data', function () {
|
||||
return {
|
||||
user: {
|
||||
},
|
||||
login() {
|
||||
axios.post('login', this.user)
|
||||
.then(data => {
|
||||
localStorage.setItem("username", this.user.name);
|
||||
location.href = "/admin";
|
||||
})
|
||||
},
|
||||
init() {
|
||||
window.addEventListener('load', () => {
|
||||
document.title = "登录到 - " + window.config.name + "";
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user