<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vue2</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<style>
.red .el-input__inner {
color: red;
font-size: 20px;
}
h1 {
font-family: font-number;
}
</style>
<body>
<div id="app">
<el-input class="red" v-model="input" @input="input=input.replace(/^(0+)|[^\d]+/g,'')" placeholder="请输入内容">
</el-input>
</div>
</body>
<script>
var app = new Vue({
el: '#app',
data: {
input: "",
},
methods: {
}
})
</script>
</html>
vue el-input输入限制
最新推荐文章于 2024-07-13 17:50:40 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)