我想加载一个 html 页面而不使用 htmx 刷新页面。例如,如果我在 http://localhost/sample/home 并且我想导航到联系我们页面,我单击联系链接并加载联系页面内容而不刷新页面。可能吗?
问问题
102 次
我想加载一个 html 页面而不使用 htmx 刷新页面。例如,如果我在 http://localhost/sample/home 并且我想导航到联系我们页面,我单击联系链接并加载联系页面内容而不刷新页面。可能吗?
是的,这可以通过 htmx 实现。以hx-get标签为例。
<html>
<body hx-target="this">
<a hx-get="/contact-us">Contact Us</a>. When this link is clicked, the document body will be swapped with whatever you have in the file named /contact-us
</body>
</html>