SOURCE

console 命令行工具 X clear

                    
>
console
/* Vue.http.interceptors.push((request, next) => {
 console.log("ddd")//此处this为请求所在页面的Vue实例
 // modify request
 request.method = 'GET';//在请求之前可以进行一些预处理和配置
  next((response) => {//在响应之后传给then之前对response进行修改和逻辑判断。对于token时候已过期的判断,就添加在此处,页面中任何一次http请求都会先调用此处方法
  console.log("response.status:"+response.status);
  //  response.body=response.body;
   return response;
 });
});
*/



var app = new Vue({

	el:'#app',
	data:{
		content:'。◕ᴗ◕。',
	},
	methods:{
		getJson:function(){
			
			//Get this
			//https://jsonplaceholder.typicode.com/comments?postId=1
			
			//var url='https://jsonplaceholder.typicode.com/comments?postId=1';
		//	this.$http
			//	.get(url,{'postId':1})
      this.$http({
        method:'GET',
      //	url:'https://jsonplaceholder.typicode.com/comments?postId=10',
        url:'http://pv.sohu.com/cityjson',
      //  url:'http://pv.sohu.com/cityjson?ie=utf-8',
     //url:'http://ip.taobao.com/service/getIpInfo.php?ip=63.223.108.42',
        headers:{'clientId':'XXD_INTEGRATION_PLATFORM','clientTime':'1548923465585'},
      params:{'ie':'utf-8'},
      })
				.then(function(data){
				//	this.content = data.body;
        this.content=data;
				},function(respones){
        this.content=respones;
			})
		},//getJson
		
		
	}//methods
	
});
<script src="https://cdn.bootcss.com/vue-router/3.0.1/vue-router.js"></script>
<script src="https://cdn.bootcss.com/vue-resource/1.5.1/vue-resource.js"></script>

<div id="app">
	
<pre>{{content}}</pre>

<button @click="getJson">getJson</button>

</div>
/* 

https://github.com/pagekit/vue-resource/blob/HEAD/docs/http.md#example

https://github.com/pagekit/vue-resource
https://jsonplaceholder.typicode.com/posts/1



目前研究失败,有空我再看看什么问题~

http://www.zymseo.com/vue/466.html


 */


pre{
	border:2px dotted #890604;
	padding:1rem;
}