【问题标题】:autofocus in ngx-otp-input doesn't work in ionic 5ngx-otp-input 中的自动对焦在 ionic 5 中不起作用
【发布时间】:2021-10-18 14:10:44
【问题描述】:

我在示例 https://www.npmjs.com/package/ngx-otp-input#otpchange 中尝试使用 ionic 5 的 ngx-otp-input,但 autofocus 对我不起作用。 有什么想法吗?

【问题讨论】:

    标签: input ionic5 autofocus


    【解决方案1】:

    Add in HTML

    <ngx-otp-input [config]="otpInputConfig" (otpChange)="handeOtpChange($event)" (fill)="handleFillEvent($event)">
        </ngx-otp-input>
    

    Add in TS File

    otpInputConfig: NgxOtpInputConfig = {
        otpLength: 6,
        autofocus: true,
        classList: {
          inputBox: "my-super-box-class",
          input: "my-super-class",
          inputFilled: "my-super-filled-class",
          inputDisabled: "my-super-disable-class",
          inputSuccess: "my-super-success-class",
          inputError: "my-super-error-class"
        }
      };
    
      handeOtpChange(value: string[]): void {
        console.log(value);
      }
    
      handleFillEvent(value: string): void {
        console.log(value);
      }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-19
      • 1970-01-01
      • 1970-01-01
      • 2015-11-14
      • 1970-01-01
      相关资源
      最近更新 更多