Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ionic-vue, How to setFocus on Next button press in native keyboard?

$
0
0

I’m having difficulties trying to change focus from one input to another by pressing the next button in android/ios keyboard since there is no example for the usage of setFocus method.

Maybe somebody here has already achieved this before? Can anyone please show me some example?

What I’ve tried so far:

// template
<form-input
  enterkeyhint="next"
  @keyup.enter="changeFocus('password')"
/>

<form-input
  ref="password"
/>

// .ts
methods: {
  changeFocus(nextFocus: string): void {
    this.$refs[nextFocus].setFocus();
  },
},

// errors
TS2571: Object is of type 'unknown'.
[vue-cli-service]     80 |     methods: {
[vue-cli-service]     81 |       changeFocus(nextFocus: string): void {
[vue-cli-service]   > 82 |         this.$refs[nextFocus].setFocus();
[vue-cli-service]        |         ^^^^^^^^^^^^^^^^^^^^^
[vue-cli-service]     83 |       },
[vue-cli-service]     84 |     },
[vue-cli-service]     85 |   });

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>