App/Reducers/ShopCarReducer.js
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
import * as types from '../Action/ActionType';
const initialState = {
//购物车数据
ShopDate: {},
isLoading: true,
isRefreshing: false,
//carbar 全选的状态
isSelectAll: false,
//单选一个
isSelectOne: false,
// 购物车商品数量
cartShopCount: 0,
// 当前所选商品数量
currentSelectCartGoodsCount: 0,
//单个商品ID
shopID: 0,
//已选择的商品数组
selectShopArr: [],
//所有商品数组
allShopArr: [],
//改变购物车状态
isChangeShopCar: false,
};
let shopCarReducer = (state = initialState, action) => {
// console.log(state)
switch (action.type) {
//获取全部
case types.FETCH_SHOPCART_LIST:
return Object.assign({}, state, {
isRefreshing: action.isRefreshing,
isLoading: action.isLoading
})
case types.RECEIVE_SHOPCART_LIST:
let shopArray = [];
let shopPrices = 0;
action.shopCarDate.shopcargroup.map((object, i) => {
object.car_productlist.map((object, i) => {
state.allShopArr.push(object);
state.selectShopArr.push(object);
});
});
return Object.assign({}, state, {
ShopDate: action.shopCarDate,
isRefreshing: false,
isLoading: false,
isSelectAll: true,
})
//全选全部
case types.FETCH_SELECTAll_LIST:
后面还有 146 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
