[Vuejs]-How can I configure Simple-keyboard in vue3 with custom layout and clearInput()

0👍

You did not add the add the component to your data, that’s why you cannot access it.

You can use Vue.component()

var keyboard = Vue.component('keyboard');

0👍

Solved it, quite silly mistake from a noob actually.

All I had to do was add a reference:

 <SimpleKeyboard 
                    ref="simplekeyboard"
                    @onChange="onChange" 
                    @onKeyPress="onKeyPress" 
                    :input="input"
                    :layout="layout"
                ></SimpleKeyboard>

AND define the method in the child as well.
I thought I could immediately access the methods of Simple-Keyboard, but actually I had to acces the method in the simple-keyboard claas withing the component.
So after adding:

 clearInput(){
      this.keyboard.clearInput();
    },

in the Simple-Keyboard component, I could access the method,

Feels something like .keyboard.clearInput(), acceess in a two step approach

Leave a comment