【问题标题】:Vuelidate name in Vuejs?Vuejs中的Vuelidate名称?
【发布时间】:2021-03-13 07:13:46
【问题描述】:

 fullname: '',
 max: 30,
  fullname: { required, minLength: minLength(30), maxLength: maxLength(29) },
  
    computed: {
    isDisabled: function(){

      return !this.terms  || (this.fullname.length  < this.max) || (this.mobile.length < this.maxmobile)
      || (this.gstin.length < this.maxgstin) || (this.email.length < this.maxemail);
      
      
  },
<input
type="text"
id='fullname'  v-model='fullname'
v-model.trim="$v.fullname.$model"
:class="{ 'is-invalid': validationStatus($v.fullname) }"
class="input-section"
:maxlength="max"
v-on:keypress="isLetter($event)"
placeholder="Enter your name"
/>

<button class="register-button":disabled='isDisabled'
v-on:click=" isFirstScreen">PROCEED</button>

如果我保持 maxfullname=10 的条件,则在输入 10 个字符后,仅启用按钮。但我需要全名的 maxlength 应该是 30 个字符,即使用户输入少于 30 个字符(10、5、6....等),也必须启用按钮。

【问题讨论】:

    标签: vue.js vuelidate


    【解决方案1】:
    fullname: { required, maxLength: maxLength(29) },
    computed: {
    isDisabled: function() {
      return !this.terms  || (this.fullname  < this.max) || (this.mobile.length < this.maxmobile)
      || (this.gstin.length < this.maxgstin) || (this.email.length < this.maxemail);
    },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 2017-08-18
      • 2018-12-15
      • 1970-01-01
      相关资源
      最近更新 更多