Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: route传state信息 #124

Open
gavanx opened this issue Sep 24, 2021 · 0 comments
Open

Feature: route传state信息 #124

gavanx opened this issue Sep 24, 2021 · 0 comments

Comments

@gavanx
Copy link

gavanx commented Sep 24, 2021

export const route = (ctx, config) => {
ctx.history.push(generateRouterOptions(config));
}

function generateRouterOptions(config) {
const { query, search, path } = config;
if (isUndefined(query) && isUndefined(search)) {
return path;
}

const finalSearch = search || ?${queryString.stringify(query)};

return {
pathname: path,
search: finalSearch,
};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant