RouteWrapper里面的一个函数
HUANGDYANG opened this issue · 1 comments
HUANGDYANG commented
const mergeQueryToProps = () => {
const queryReg = /?\S*/g;
const removeQueryInRouter = (restProps: any, reg: RegExp) => {
const { params } = restProps.match;
Object.keys(params).forEach((key) => {
params[key] = params[key] && params[key].replace(reg, '');
});
restProps.match.params = { ...params };
};
restProps = removeQueryInRouter(restProps, queryReg);
const merge = {
...restProps,
query: queryMemo,
};
return merge;
};
你好,请问为何要加这段代码,测不出来有什么作用,restProps.match.params好像一直是空对象
yezihaohao commented
用来支持以问号的形式传递参数到具体的页面组件