UniApp
The input
label while providing @input
events, but only small program can use, so here we use the native onkeypress
event to avoid input spaces.
Solution:
<input class="uni-input"
onkeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"
v-model="password"
type="text" name="password"
:password="hidePsd"
placeholder="请输入密码" />
[Note] corresponding to the spaces keyCode
32.
Personal blog: Roc's Blog