简体   繁体   中英

Getting the current path in a LiveView

In a normal route:

get /index, MyController, :index

I can simply get the route from Plug.Conn 's path_info function.

However if I have a live route, how do I retrieve the current path?

live /index, IndexLive

You can get the current uri using handle_params callback which is called after mount and before render.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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