1.下载vue-resource插件
cnpm install vue-resource
1.2全局引入vue-resource:
在main.js
import VueResource from 'vue-resource';
Vue.use(VueResource);
2.把静态josn文件放在项目根的 static文件夹:
![](https://images2018.cnblogs.com/blog/1322162/201806/1322162-20180623110811366-68985456.png)
3.发送请求:
getNum() {
this.$http.get("static/data/unusedorder.json").then(data => {
console.log(data.data.unusedItems);
});
}