@jdplus/tea

1.0.2 • Public • Published

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));		//错误的回调函数	
		

Readme

Keywords

Package Sidebar

Install

npm i @jdplus/tea

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

8.26 kB

Total Files

3

Last publish

Collaborators

  • wangzheng136
  • plus-components
  • shitou
  • iwander
  • cathy_huang