Javascript 如何禁用按钮,直到用户在Vuejs的Otp字段中输入数字?

Javascript 如何禁用按钮,直到用户在Vuejs的Otp字段中输入数字?,javascript,vue.js,Javascript,Vue.js,验证 您可以在更改时使用,或在完成时使用 请像这样试试 <v-otp-input ref="otpInput" input-classes="otp-number" separator=" " :num-inputs="4" :should-auto-focus="true" :is-input-num="true"


验证

您可以在更改时使用
或在完成时使用

请像这样试试

<v-otp-input
    ref="otpInput"
    input-classes="otp-number"
    separator=" "
    :num-inputs="4"
    :should-auto-focus="true"
    :is-input-num="true"
    @on-change="handleOnChange"
    @on-complete="handleOnComplete"
/>
<button class="verify-button" v-on:click="isFadeout = true"  :disabled="!otp_complete" >VERIFY</button>

...
data() {
    return {
      otp_value: '',
      otp_complete: false
},
methods: {
    handleOnComplete(value) {
      this.otp_complete = true;
      this.otp_value = value;
    },
    handleOnChange(value) {
      this.otp_value = value;
    },
},
...


显示更多代码<如果
v-otp-input
数据中有
v-otp-input
字段,并且
v-otp-input
组件将该字段用作
v-model
<button class="verify-button" v-on:click="isFadeout = true"  :disabled="otp_value.length < 4" >VERIFY</button>