uniapp 微信小程序 输入框限制输入2位小数

此处input的typedigit

bash 复制代码
<input v-model="amount" type="digit" placeholder="请填写金额" @input="checkAmount"/>
bash 复制代码
data() {
	return {
		amount:""
	}
}
bash 复制代码
methods: {
	// 小数点后2位
	checkAmount(e){
		e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
		this.$nextTick(() => {
			this.amount = e
		})
	},
}
相关推荐
qq_242188633211 小时前
微信小程序AI象棋游戏开发指南
人工智能·微信小程序·小程序
PD我是你的真爱粉1 天前
Vue3核心语法回顾与Composition深入
前端框架·vue
予你@。1 天前
UniApp + Vue3 实现 Tab 点击滚动定位(微信小程序)
微信小程序·小程序·uni-app
游戏开发爱好者81 天前
完整教程:App上架苹果App Store全流程指南
android·ios·小程序·https·uni-app·iphone·webview
予你@。1 天前
uni-app progress 组件使用详解
uni-app
iOS阿玮1 天前
春节提审高峰来袭!App Store 审核时长显著延长。
uni-app·app·apple
码云数智-大飞1 天前
小程序商城哪个平台好?小程序商城制作平台深度对比
微信小程序
code袁1 天前
基于Springboot+Vue的家教小程序的设计与实现
vue.js·spring boot·小程序·vue·家教小程序
2501_916007471 天前
ios上架 App 流程,证书生成、从描述文件创建、打包、安装验证到上传
android·ios·小程序·https·uni-app·iphone·webview
是梦终空2 天前
计算机毕业设计266—基于Springboot+Vue3的共享单车管理系统(源代码+数据库)
数据库·spring boot·vue·课程设计·计算机毕业设计·源代码·共享单车系统