1.0.2 • Published 4 years ago

@jdplus/tea v1.0.2

Weekly downloads
2
License
ISC
Repository
-
Last release
4 years ago

tea.js组件

基于promise的ajax组件,支持IE9和iOS8低版本

引用方式

/**  es6引用 **/
	import tea  from 'tea.js';

使用方法

/** get方式请求  **/
	tea.get(url,data,corss)
		.then(data => successCb(data));  //成功的回调函数
		.catch(err => errorCb(err));		//错误的回调函数
	
	/** post方式请求  **/
	tea.post(url,data,corss)
		.then(data => successCb(data));  //成功的回调函数
		.catch(err => errorCb(err));		//错误的回调函数
	
	/** jsonp方式请求  **/
	tea.jsonp(url,data,corss)
		.then(data => successCb(data));  //成功的回调函数
		.catch(err => errorCb(err));		//错误的回调函数
		
		
	/** 跨域接口  get方式请求 最后一个参数传true即可支持 **/
	tea.get(url,data,true)
		.then(data => successCb(data));  //成功的回调函数
		.catch(err => errorCb(err));		//错误的回调函数