admin管理员组文章数量:1122846
I have problems with 11ty and alpineJs. I have input and its type is number. When I removed everything from the input, the value changed to null (just null). Please help me if you can solve it
for this I set value, defaultValue, default and everything else I Just don't want fix it in Js and I need to solve it in html I was doing everything but I don't have a solution for it. use my input as a component
{% macro unitNumberField(params) %}
<div
class="inline-flex flex-row items-center gap-2 rounded-md border border-onSecondaryContainer border-opacity-10 shadow-sm pe-4 focus-within:outline focus-within:outline-2 focus-within:outline-tertiary focus-within:border-none focus-within:shadow-none"
{% if params.invalidHandler %}:class="{'!border-error focus-within:!outline-error': {{ params.invalidHandler }}}"{% endif %}
>
<input
type="number"
dir="ltr"
{% if params.model %}x-model.number="{{ params.model }}"{% endif %}
{% if params.onInput %}@input.debounce.250ms="{{ params.onInput }}"{% endif %}
placeholder="{{ params.placeholder }}"
class="peer bg-transparent inline-block ps-4 h-10 rounded-md border-none !shadow-none hide-spin focus-visible:outline-none {{ params.customInputClass }}"
autocomplete="{{ params.autocomplete | default('off') }}"
value="{{ params.value }}"
min="{{ params.min | default(0) }}"
/>
<span
class="opacity-80 {{ params.customUnitClass }}"
{% if params.dynamicUnitContent %}
x-text="{{ params.dynamicUnitContent }}"
{% endif %}
>
{{ params.unitContent | safe }}
</span>
</div>
{% endmacro %}
本文标签: htmlset null value for my model with 11ty and alpineJSStack Overflow
版权声明:本文标题:html - set null value for my model with 11ty and alpineJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736281808a1926439.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论