首页 > 代码库 > 这种方式赋值必须为对象

这种方式赋值必须为对象

标红的"{}"必须加,使之成为对象

export function productListAction(isRefreshing, loading, isLoadMore, filterData=http://www.mamicode.com/{}, spName, sort, pageNo=1) {    let queryData = Object.assign({}, filterData, {spName}, {sort}, {pageNo});    console.warn(‘product===>‘,queryData);    return  (isRefreshing || loading) ?         {types: [FETCH_PRODUCT_LIST.code, SUCCESS_PRODUCT_LIST, FAILURE_PRODUCT_LIST],            callAPI: () => request(FETCH_PRODUCT_LIST.url, REQUEST_METHOD_POST, stringify(queryData)),            payload: {isRefreshing, loading, isLoadMore, queryData, pageNo}        } : {type: CLEAR_PRODUCT_LIST, isRefreshing, queryData, loading};}

 

这种方式赋值必须为对象