Vue基础-router
生成访问路径
ts
const showProjectHistory = (gitProjectId: number) => {
router.push({
path: `/ci/project-pipeline/${gitProjectId}?rand=${new Date().getSeconds()}`,
});
};
const showProjectHistory = (gitProjectId: number): string => {
const resolvedRoute = router.resolve({
path: `/ci/project-pipeline/${gitProjectId}`,
query: { rand: new Date().getSeconds().toString() },
});
return resolvedRoute.href; // Returns the resolved URL as a string
};