span style=colorblue;cursor pointer; click=toNewsscoperownewsId scoperownewsId span import useRoute useRouter from vue-router;const route = useRoute;const router = useRouter;function toN
The error message suggests that there is no matching route for the name "/news/list" with the specified query parameters.
To fix this issue, you should check your router configuration and ensure that there is a route defined with the name "/news/list" and that it accepts the "newsId" parameter as a query parameter.
Here's an example of how you can define a route with a name and query parameter in Vue Router:
import { createRouter, createWebHistory } from "vue-router";
const routes = [
{
path: "/news/list",
name: "newsList",
component: NewsList,
props: (route) => ({ newsId: route.query.newsId }),
},
// Other routes...
];
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;
In this example, the route "/news/list" is defined with the name "newsList" and accepts the "newsId" parameter as a query parameter. The value of the "newsId" parameter is then passed as a prop to the component specified in the "component" property.
Make sure to adjust the route configuration to match your specific requirements.
AI 优化版
原文地址:https://www.cveoy.top/t/topic/i13g 著作权归作者所有。请勿转载和采集!