1

I have a data-table in Vue.js component using Vuetify with a input inside a row, and I need to disable a button if the input v-model="row.item.quantidade" was empty. but doesn't work.

HTML

                     <v-data-table :headers="headersAllStep3" :items="step2" :search="searchAllStep3">
                        <template v-slot:item="row">
                          <tr>
                           <td>{{ row.item.produto }}</td>
                           <td>{{ row.item.descricao }}</td>
                           <td>{{ row.item.ncm }}</td>
                           <td><input type="number" v-model="row.item.quantidade"  autofocus></td>
                          </tr>
                        </template>
                      </v-data-table>

           <v-btn :disabled="isDisableQuantidade()">
            Continue
           </v-btn>

Javascript method in vue.js component

isDisableQuantidade(){
          return this.step2.quantidade.length == false;
        },

1 Answer 1

3

The function :

isDisableQuantidade(){
          return this.step2.some(step=>step.quantidade==0);
        },

should be a computed property and it must be used without () like :

 <v-btn :disabled="isDisableQuantidade">
        Continue
  </v-btn>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.