如何在模板中获取到当前页面url?
#6824
-
Beta Was this translation helpful? Give feedback.
Answered by
guqing
Oct 11, 2024
Replies: 2 comments 2 replies
-
/ping @guqing |
Beta Was this translation helpful? Give feedback.
0 replies
-
目前没有提供这样的方法,只能通过 js 实现,可以使用 https://alpinejs.dev/ 这样的库来配合写模板可能是一个好的办法
没有,参考第 2 点,示例项目 https://github.com/halo-dev/theme-earth/blob/main/src/alpine-data/share.ts |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
WAGFS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
${#ctx.getExchange().getRequest().getPathWithinApplication()}
目前没有提供这样的方法,只能通过 js 实现,可以使用 https://alpinejs.dev/ 这样的库来配合写模板可能是一个好的办法
没有,参考第 2 点,示例项目 https://github.com/halo-dev/theme-earth/blob/main/src/alpine-data/share.ts