[Vuejs]-Vue js : get the inputed string and display , get also lenght of string

0👍

Bind your currentSearchInput to the input using v-model. You do not need saveInput at all.

<input v-model='currentUserInput' type="text" />
{{currentSearchInput}} {{currentSearchInput.length}}
setText() {
      this.message = this.currentSearchInput;
    },

Your code has currentSearchInput and currentUserInput. Typo?

0👍

Yes, I agree with Steven. Don’t need to use saveInput function. Just use v-model="currentUserInput" and then when clicking the button, just set like that;

    setText() {
      this.message = this.currentUserInput;
    },

Leave a comment