有人在 remix.config 中有一些关于 defineRoutes 函数的额外信息吗?
我有一条这条路线:
{
"id": "routes/__main/city/$city", "path": "/city/:city",
"file":"routes/__main/city/$city.tsx"
}
在defineRoutes中我做了这样的事情:
routes: async (defineRoutes) => {
return defineRoutes((route) => {
route("/citta/:city", "routes/__main/city/$city.tsx");
});
},
我希望 /citta/test 和 /city/test 都在位于此处的同一个文件routes/__main/city/$city.tsx
中。
但是当我运行代码时,只有 /citta/test 路由处于活动状态,而另一个 /city/test 会抛出错误。
正如我从这里的文档https://remix.run/docs/en/v1/api/conventions#routes中读到的,我想要实现的应该是可能的。
我误解了defineRoutes的使用吗?