<html lang="en">
<head>
<title>输入框只输入数字</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<script src="js/vue.min.js"></script>
</head>
<body>
<div id="demo">
<input type="text" placeholder="只能输入11位数字字符" class="input" maxlength="11"
οnkeyup="if(this.value.length==1){this.value=this.value.replace(/[^19]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"
onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-19]/g,'')}else{this.value=this.value.replace(/\D/g,'')}">
</div>
<script>
</script>
<style lang="less">
input{width: 200px;height: 20px;}
</style>
</body>
</html>