hx-request
hx-request
属性允许你通过以下属性配置请求的各个方面:
¥The hx-request
attribute allows you to configure various aspects of the request via the following attributes:
timeout
- 请求的超时时间(以毫秒为单位)
¥timeout
- the timeout for the request, in milliseconds
credentials
- 如果请求将发送凭据
¥credentials
- if the request will send credentials
noHeaders
- 从请求中删除所有标题
¥noHeaders
- strips all headers from the request
这些属性使用类似 JSON 的语法设置:
¥These attributes are set using a JSON-like syntax:
<div ... hx-request='{"timeout":100}'>
...
</div>
你可以通过添加 javascript:
或 js:
前缀来动态评估值:
¥You may make the values dynamically evaluated by adding the javascript:
or js:
prefix:
<div ... hx-request='js: timeout:getTimeoutSetting() '>
...
</div>
¥Notes
hx-request
是合并继承的,可以放在父元素上
¥hx-request
is merge-inherited and can be placed on a parent element