菜单是动态从接口里面读取的,但是不知道怎么写 module.exports ,不知道怎么在ajax里面写module.exports
const func = function () {
let $d = {};
$d.opId = Cookie.get('user_id');
$d.tokens = Cookie.get('tokens');
Ajax.ajax({
url: Config.api+"/menu/queryAllMenuList",
method:"post",
data:$d,
//processData: options.method === 'get',
dataType: 'JSON',
}).done((data) => {
return [];
})
};
The acquired data is assembled into a structure that can be recognized by the antd component. For example, does the dataSource attribute of table recognize an array?
Encapsulate ajax into a function, call this function and get the value of ajax.
The rest is a matter of manipulating data.
ajax is asynchronous, so module.exports cannot get the value of ajax.
Call ajax in the module, set a state, change the value of the state after the callback is successful, and then assemble it into an antd component in render