[Vuejs]-How to disable button until condition satisfy in Vuejs?

0👍

try validating the mobdis with js

something like this:

export default {
  name: "HelloWworld",

  data: function () {
    return {
      mobdis: false,
      mobile: "",
      maxmobile: 10,
    };
  },

  methods: {
    isMobile(event) {
      /* other codes */
      this.$nextTick(function () {
        if (event.value.length > 9) {
          // check if this field (number) has value lenght 10
          this.mobdis = true;
        } else {
          this.mobdis = false;
        }
      });
      /* other codes */
    },
  },

  /* validations: {
    computed: {
      isDisabled: function () {
        return !this.mobdis;
      },
    },
  }, */
};

Leave a comment