简体   繁体   English

react-admin中如何处理按钮类型ListItem中的方法类型?

[英]how to handle the method type in ListItem of type button in react-admin?

In raect-admin I have thomething like this:在 raect-admin 我有这样的东西:

   <ListItem 
      button
      to={`/XXX/${record.id}`}
      component={Link}
      key={record.id}
   >

when clicking on the link I want to render the show component but get the edit component.单击链接时,我想呈现显示组件但获取编辑组件。

Do you knoe why?你知道为什么吗? and how to fix it?以及如何解决?

and actually how to handle the method type?实际上如何处理方法类型? GET PUT DELETE POST?获取删除帖子?

thank you!谢谢你!

Try routing to the /[resource]/[id]/name route:尝试路由到/[resource]/[id]/name路由:

   <ListItem 
      button
      to={`/XXX/${record.id}/show`}
      component={Link}
      key={record.id}
   >

As for the GET / DELETE / POST verb, this is something you should handle in your dataProvider (see https://marmelab.com/react-admin/DataProviders.html for details).至于 GET / DELETE / POST 动词,这是您应该在 dataProvider 中处理的内容(有关详细信息,请参阅https://marmelab.com/react-admin/DataProviders.html )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM