Would you like to ask the boss about vue ref getting the input value?

want to get the value of input to judge by the length of value, but have a problem? Input is the code under the el-input of element

<el-input placeholder="" v-model="barId" clearable style="width: 70%;" v-on:input ="inputFunc" ref="barNo"></el-input>

this is the code for the layout, with ref

added at the end.
inputFunc() {
    console.log(this.$refs.barNo)
    console.log(this.$refs.barNo.value)
    const param = {
      BarCode: this.barId
    };
    api.getbarcodeinfo(param).then(response => {
      if (response.data.Success == false) {
        this.$notify({
          title: "",
          message: response.data.Message,
          type: "error",
          duration: 2000
        });
      } else {
        console.log(this.$refs.barNo.value)
        // this.barId = "";
      }
    });
  },

this is the code of vue that prints the value of input three times respectively. For the first time, console can get the value of the whole input, including the value in the input box, and the result of the second console is a null, and the third console can print out value. I don"t quite understand. I don"t know why the vue document can"t be opened today, so I"d like to ask the boss what the reason is and how to solve it. Thank you

clipboard.png

Dec.01,2021

you can get the value of barId directly


Don't use it this way. ref is not responsive, and the third is valuable because BarCode: this.barId triggers get for dependency collection.
should be changed to watch .


normally, the second console.log can print out value. There should be something wrong elsewhere. I can output it according to your code

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35ebe-2bfc7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35ebe-2bfc7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?