Click the keyboard to get the keyboard value 1, and then this.originalprice+=1 it
throw a brick to attract jade, the idea is as follows
keyboard only?
1-- unique, then adjust the keyboard through the @ focus
trigger method, and save the unique flag of the input that triggers the keyboard through variables to ensure that the changed value corresponds to
2-- not unique, and constitutes a separate business logic component with the input component. Then the identification is processed internally. Generally consider the method of changing the value of the timestamp
-string concatenation, including deleting and emptying the string, and handling the corresponding variable
through a unique flag.
<input @focus="inputOnFocus" v-model="inputValue" id="test1"/>
...
data(){
inutFocus:'inputId',
inputValue:''
},
methods:{
inputOnFocus(e){//input iteminput,event
this.showKeyBoard();
this.inutFocus = e.target.id //item = item.id
},
keyboardClick(){
//
let clickValue = 'a';
this.inputValue += clickValue;// inputValue
}
}
still does not quite understand, my keyboard is the only one, I also set the method on the keyboard to get the current value I clicked on the method, and debug the output of the value is correct. I use the code var x = document.activeElement.nodeValue; to dynamically get which box the current focus is in and get its current value. My consideration is that every time I click on the keyboard, this code is executed so that I can get the last value, and then concatenate y = x.toString () + key.toString ();, and then assign the value to the current input box. The problem now is that, first, even if I assign the initial value to a real number (that is, not zero) in both input boxes, I always output x = null. Second, after stitching, how to assign the value to the current input box, and how to get its v-model binding value through the focus element