Hzero通过值集获取下拉框数据

it2024-04-11  46

引入工具方法 import { queryMapIdpValue } from '../../services/api'; 在DVA数据池定义一部函数方法 *feacthSelectOption({payload},{call , put }){ const res = getResponse( yield call(queryMapIdpValue,{ // 值集字段名和值集编码 seal_status_code:"CSGN.SEAL_STATUS_2" })); // 更新state if(res){ yield put({ type:"updateState", payload:{ list:res } }) } return res }

3.在类组件中周期函数中调用方法

componentWillMount = () => { const { dispatch } = this.props; dispatch({ type: 'stampapply/feacthSelectOption', }).then( ()=> { // 一定要在then函数中获取state中的数据,否则拿不到最新的 const { selecteoption } = this.props; this.setState({ selecteoption, }); }); };
最新回复(0)