# # the vue web page

template

<div class="flex flexAlignCenter form_item"> <span class="item_name">User name</span> <div class="item_right"> <input type="text" v-model="query.username" ref="gain"> <img src=".. /.. /assets/images/edit.png" alt="" class="icon_edit" @click="editName"> </div> </div>Copy the code

methods

editName(){
    this.query.username = ''
    this.$nextTick( () =>{
        this.$refs.gain.focus()
    })
}
Copy the code