ant models 内获取 url 的参数传递到组件

models代码:

import { getCList} from "@/services/api";
import { MessageTip } from '@/utils/tools.js'
import { router } from 'umi';

const customerModel = {
    namespace: 'customerModel',
    state: {
        channelList: [],  // 渠道列表
    },
    reducers: {
        getUrlQuery(state, { payload }) {
            console.log('=====================',payload)
            return {
                ...state,
                urlQuery: payload
            }
        },
    },
    effects: {
        
        // 获取户列表
        *getCList({ payload }, { call, put }) {
            const response = yield call(getCList, payload)
            if (response.code == 1) {
                yield put({
                    type: 'xxx',
                    payload: response
                })
            }
        },
    },
    subscriptions: {
        // 订阅监听,比如我们监听路由,进入页面就如何,可以在这写
        setup({ dispatch, history, query }) {
            return history.listen(async ({ pathname, search, query }) =
©️2019 CSDN 皮肤主题: 代码科技 设计师: Amelia_0503
应支付9.90元
点击重新获取
扫码支付

支付成功即可阅读