參考:https://www.cnblogs.com/wdxue/p/8868982.html
1.下載插件 npm install axios --save 2.在main.js下引用axios import axios from 'axios' Vue.prototype.$http=axios 3.在static文件夾下寫靜態文件 home.json { "name":"xuexue", "age":20 } 4.在組件中請求數據 this.$http.get('../../static/home.json') .then(function(res){ console.log(res) }) .catch(err=>{console.log(err)} )