jrbasic
v1.1.0
Published
npm install jrbasic --save
Downloads
68
Readme
#jrbasic
npm install jrbasic --save
#简融基础
/*fetch请求*/
export const jrRequest = _jrRequest;
export const getFetchPromise = _getFetchPromise;
export const fetchGet = _fetchGet;
export const fetchPost = _fetchPost;
export const AjaxGet = _AjaxGet;
export const AjaxPost = _AjaxPost;
/*others其他*/
export const remSet = _remSet;
export const searchToObj = _searchToObj;
export const checkTel = _checkTel;
export const isIosAndroid = _isIosAndroid;
/*log埋点*/
export const addJrLog = _addJrLog;
export const addGrowingLog = _addGrowingLog;
/*cookie操作*/
export const setCookie = _setCookie;
export const getCookie = _getCookie;
#使用
import { jrRequest, AjaxPost, AjaxGet, remSet } from 'jrbasic';
###设置页面的rem单位
remSet(document, window); 设计稿宽度为375px 1rem相当于20px
###路由参数转换
searchToObj("?letter=2&opp=23") ==>>> {letter:2, opp:23}
###action示例
export const getBanner = () => {
return function (dispatch) {
jrRequest({
requestType: 'GET', /*请求方法GET/POST 不指定默认GET*/
dispatch: dispatch, /*dispatch方法 必传参数*/
jrApi: apiGetBanner, /*Api url 请求地址*/
fetchPrm: {hello: '2'}, /*请求参数object形式*/
requestingAction: requestPosts, /*请求过程中的action钩子*/
successAction: bannerImagesSet, /*请求成功后的action钩子 必传*/
errorAction: errorPosts, /*请求失败的action*/
extra: extra /*action的第二个参数 自己定义*/
});
}
};
###基础动画样式(animate简融版)
引用方式 使用方式, 只需引用一次即可 不需要每个组件都import
import 'jrbasic/jrAnimate.less'
...
<p class="animated hinge flash">hello world</p>
<p class="animated bounceIn pulse">hello world</p>
<p class="animated fadeIn">hello world</p>
<p class="animated fadeInDown">hello world</p>
<p class="animated fadeOut">hello world</p>
使用例子参照包里的jrAnimateExample.html
或者 https://daneden.github.io/animate.css/