iview-admin2.5.0登录
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://pwwzsj.com/article/iiigps.html