当前需要使用的组件:

 1 import data from './test.json'
 2   export default{
 3     data(){
 4       return{
 5         userinform: ''
 6       }
 7     },
 8 mounted(){
 9   this.userinform = data
10   }
11 }

test.json就是普通json格式就可以了!然后完美解决!

 

后台服务器请求json方式:

1   this.$http.get('url').then(response => {
2     //succces callback
3 
4     var data = response.body;
5   }, response => {
6     // error callback
7     alert('连接失败!')
8   });

 如需交流可加博主QQ:602697966(备注博客园)

posted on 2017-08-24 14:42  佑之以航  阅读(17691)  评论(1编辑  收藏  举报