axios请求参数有调用jquery
axios.post('/api/flight/video', {
"path": [[${initConfig.cameraIndexCode}]],
"beginTime": "d:/new.jpeg",
"endTime": $("#endTime").val()
}).then(function (response) {
}).catch(function (error) {
console.log(error);
});
请求ajax后执行一个方法
function loadCameraTree() {
axios.get(window.predefined.publicPathPrefix + "api/camera").then(function (response) {
var cameraTree = response.data;
cameraTree = {"name": "摄像头列表", open: true, "id": -1, "type": "Dir", "children": cameraTree};
initCameraTree(cameraTree);
selNode = $.fn.zTree.getZTreeObj("cameraTree").getNodes()[0];
renderTable(selNode);
}).catch(function (error) {
console.error(error)
bootstrapAlert("读取摄像头失败,请刷新并重试");
})
}
post传参
axios.post('/api/flight/video', {
base64Img: obj['base64']
}).then(function (response) {
}).catch(function (error) {
console.log(error);
});
各种请求传参
get delete 方法较为不同
axios.get(url[, config])
axios.delete(url[, config])
axios.post(url[, data[, config]])
axios.put(url[, data[, config]])
axios.patch(url[, data[, config]])
get
Axios.get('demo/url', {
params: {
id: 123,
name: 'Henry',
sex: 1,
phone: 13333333
}
})
delete
Axios.delete('demo/url', {
data: {
id: 123,
name: 'Henry',
sex: 1,
phone: 13333333
}
})
put
Axios.put('demo/url', {
id: 123,
name: 'Henry',
sex: 1,
phone: 13333333
})
patch
Axios.patch('demo/url', {
id: 123,
name: 'Henry',
sex: 1,
phone: 13333333
})