写给自己的话:静态的json文件要记得放在static文件夹下,想打自己

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)})
)