先安装axios
npm install axios
然后在vue页面中进行编码:
import axios from 'axios';
export default {
name: 'App',
components: {
},
data: function(){
return {
my_pics: []
}
},
methods: {
getPicList(pic_dir) {
const path = 'http://127.0.0.1:5000/folder/'+pic_dir;
axios.get(path, null, { params: {root:pic_dir}})
.then((res) => {
this.my_pics = res.data;
})
.catch((error) => {
// eslint-disable-next-line
console.error(error);
});
}
},
created() {
},
}