How does input automatically get focus in vue?

the start interface is as follows:

clipboard.png

:

clipboard.png

my question:
I can"t get focus when switching to input

my code:

<div class="surface" @click="active_search = false" v-if="active_search">
    <div class="color">
        <van-icon name="search"/>
        

</div> </div> <div class="real" @click="active_search = true" v-else> <van-icon name="search"/> <input v-model="val" type="text" placeholder="" @change="changeInput()" ref="myInput" autofocus> </div> --------- data() { return{ active_search:true, val:"", } }, watch:{ //input active_search:function(a,b){ if(b == true){ this.$refs.myInput.focus(); } } },

watch: {
    // input
    active_search: function(a, b) {
      if (b == true) {
        this.$nextTick(function() {
          this.$refs.myInput.focus()
        })
      }
    }
  },
The reason why the

watch is changed to this way is that it has just been generated using vMuifMagint input, which is directly fetched through $refs and cannot be obtained.


autofocus= "autofocus"

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-1e5e0ea-59d06.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-1e5e0ea-59d06.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?