requirements: there are multiple Input input boxes in the form, each of which is input1, input2, input3. After the input1 input is complete, press the Enter key to automatically jump to input2. Similarly, press Enter to jump to input3 after input2 has been typed. It is true that it can be done in ref, but is there a better way to do multiple methods, or multiple judgment logic?
html section:
<input ref="wxInput" type="number" @keyup.enter.native="nextInput" .../>
<input ref="aliInput" type="number" @keyup.enter.native="nextInput" .../>
<input ref="unionInput" type="number" @keyup.enter.native="nextInput" .../>
js section:
nextInput(e) {
// e.target.nextSibling.focus() // currentTarget <!-- -->
// e.target.$ref // ref vue""
}
because there is automatic calculation logic here, it is difficult to change the original code.
question:
is there a better solution? Or is there a way to get the ref, or ref string of the current element in the element event? I really don"t want to write case when,if else that looks stupid.