前端框架使用說(shuō)明
配置 yarn
可以通過(guò)以下代碼檢驗(yàn)是否安裝了yarn yarn -v
or yarn --version
如果沒有安裝yarn可以嘗試用npm代替, 如果不行可根據(jù)以下步驟安裝yarn
macOS
可以通過(guò)Homebrew安裝
brew install yarn
windows
可以通過(guò)安裝程序安裝
安裝
yarn install --registry=https://registry.npm.taobao.org
運(yùn)行
yarn run serve
使用的UI
已配置Ant Design Vue, 可以參考的文檔
axios
實(shí)例
get
// Make a request for a user with a given ID
axios.get('/user?ID=12345')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
// Optionally the request above could also be done as
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
post
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
同時(shí)發(fā)送多請(qǐng)求
function getUserAccount() {
return axios.get('/user/12345');
}
function getUserPermissions() {
return axios.get('/user/12345/permissions');
}
axios.all([getUserAccount(), getUserPermissions()])
.then(axios.spread(function (acct, perms) {
// Both requests are now complete
}));