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 }) =
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章