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

children router bug #323

Closed
allmors opened this issue May 20, 2024 · 2 comments
Closed

children router bug #323

allmors opened this issue May 20, 2024 · 2 comments

Comments

@allmors
Copy link

allmors commented May 20, 2024

The type of effect I want is vue-router routing with nested sub-routing. Here is my example. My different paths correspond to different components, but the plug-in seems to be that if this path is used by other routes, the same type cannot be used.
image
image
image

Unable to achieve effect

const routes = {
    '/:blacklist': BlackList,
    '/:setting': Setting,
}

can achieve the effect

const routes = {
    '/:blacklist': BlackList,
    '/:setting/:xxx': Setting,
}

But what I want is that different components can be used with different pathnames in the relevant cascade

In short, it is as follows:

const routes = {
    '/:blacklist': BlackList,
    '/:setting': Setting,
}
  • /dashboard/blacklist Use BlackList component
  • /dashboard/setting Use Setting component
@ItalyPaleAle
Copy link
Owner

Do you set the prefix to the sub-routers? See docs/examples: https://github.com/ItalyPaleAle/svelte-spa-router/blob/main/Advanced%20Usage.md#nested-routers

@allmors
Copy link
Author

allmors commented May 21, 2024

Do you set the prefix to the sub-routers? See docs/examples: https://github.com/ItalyPaleAle/svelte-spa-router/blob/main/Advanced%20Usage.md#nested-routers

Yes, there is a setting

image

I found a problem. It was my mistake. My routing used the form of params, which caused the routing failure problem.

Incorrect example

const routes = {
    '/:blacklist': BlackList,
    '/:setting': Setting,
}

Correct example

const routes = {
    '/blacklist': BlackList,
    '/setting': Setting,
}

Thanks for your answer

@allmors allmors closed this as completed May 21, 2024
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

2 participants