react native 网络get请求方式参数不可为undefined(为空的话默认变为)或null
错误写法:
export function addToCartAction(isRefreshing, loading, spId, number, spfId = null, pgId = null) { console.warn(‘==>‘,spId+":"+number); return (isRefreshing || loading) ? {types: [FETCH_ADD_TO_CART.code, SUCCESS_ADD_TO_CART, FAILURE_ADD_TO_CART], callAPI: () => request(FETCH_ADD_TO_CART.url+‘?spId=‘+spId+‘&number=‘+number+‘&spfId=‘+spfId+‘&pgId=‘+pgId), payload: {isRefreshing, loading} } : {type: CLEAR_ADD_TO_CART, isRefreshing, loading}; }
正确写法:
export function addToCartAction(isRefreshing, loading, spId, number) { console.warn(‘==>‘,spId+":"+number); return (isRefreshing || loading) ? {types: [FETCH_ADD_TO_CART.code, SUCCESS_ADD_TO_CART, FAILURE_ADD_TO_CART], callAPI: () => request(FETCH_ADD_TO_CART.url+‘?spId=‘+spId+‘&number=‘+number), payload: {isRefreshing, loading} } : {type: CLEAR_ADD_TO_CART, isRefreshing, loading}; }
时间: 2024-10-08 17:45:06