import axios from "axios"; export default { login(username, password, apiUrl="http://localhost:8080"){ const url = `${apiUrl}/users/checkLogin` const data = { username: username, password: password }; return axios.post(url, data) .then(response => { alert(">login方法中<"); alert(response.data.username); return response.data; }); }, register(user){ const url = `${apiUrl}/users/checkLogin` const data = { username: username, password: password }; return axios.post(url, data) .then(response => { alert(">login方法中<"); alert(response.data.username); return response.data; }); //跳转逻辑 } }