a<闪电周围的红色边框:输入>

发布于 2025-01-21 12:17:11 字数 497 浏览 2 评论 0原文

显示红色边框

<lightning:input>

在Aura Lightning中,我想控制何时在无效输入时向用户表示的方式

。此示例显示了使用常规html https://wwww.lightningdesigndesignsignsem.com/components/ input/

”在此处输入图像描述”

In Aura Lightning, I want to control when to show a red border on a

<lightning:input>

This way I can indicate to the user when there is invalid input.

This example shows what it would look like using regular HTML https://www.lightningdesignsystem.com/components/input/

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人海汹涌 2025-01-28 12:17:11

我想出了一种方法。

    <aura:renderIf isTrue="{!v.isError}">
        <div class="slds-form-element slds-has-error">
            <label class="slds-form-element__label" for="text-input-id-48">
                <abbr class="slds-required" title="required">* </abbr>Input Label</label>
            <div class="slds-form-element__control">
                <lightning:input label=" Use the format 1d 12h 30m - d=days, h=hours, m=minutes" type="text" value="{!v.userInputTime}" aura:id="userInputTime" onchange="{!c.onDurationChanged}" placeholder="1d 12h 30m"/>
            </div>
            <div class="slds-form-element__help" id="error-message-id-49">Enter a value.</div>
        </div>
        </aura:renderIf>
        <aura:renderIf isTrue="{!not(v.isError)}">
            <lightning:input label=" Use the format 1d 12h 30m - d=days, h=hours, m=minutes" type="text" value="{!v.userInputTime}" aura:id="userInputTime" onchange="{!c.onDurationChanged}" placeholder="1d 12h 30m"/>
        </aura:renderIf>

I figured out a way to do it.

    <aura:renderIf isTrue="{!v.isError}">
        <div class="slds-form-element slds-has-error">
            <label class="slds-form-element__label" for="text-input-id-48">
                <abbr class="slds-required" title="required">* </abbr>Input Label</label>
            <div class="slds-form-element__control">
                <lightning:input label=" Use the format 1d 12h 30m - d=days, h=hours, m=minutes" type="text" value="{!v.userInputTime}" aura:id="userInputTime" onchange="{!c.onDurationChanged}" placeholder="1d 12h 30m"/>
            </div>
            <div class="slds-form-element__help" id="error-message-id-49">Enter a value.</div>
        </div>
        </aura:renderIf>
        <aura:renderIf isTrue="{!not(v.isError)}">
            <lightning:input label=" Use the format 1d 12h 30m - d=days, h=hours, m=minutes" type="text" value="{!v.userInputTime}" aura:id="userInputTime" onchange="{!c.onDurationChanged}" placeholder="1d 12h 30m"/>
        </aura:renderIf>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文