api/user.js
export const login = ({ userName, password }) => {
const data = {
username: userName,
password
}
return axios.request({
url: '/api/token',
data,
method: 'post'
})
}
config/index.js
baseUrl:
libs/axios.js
import { getToken } from '@/libs/util'
getInsideConfig () {
const config = {
baseURL: this.baseUrl,
headers: {
//
}
}
if (getToken()) {
config.headers['Authorization'] = `token ${getToken()}`
}
return config
}
store/module/user.js
const data = res.data
网站名称:iview-admin2.5.0登录
转载来于:
http://cdweb.net/article/iiigps.html