js - TuPengXiong/TuPengXiong.github.io GitHub Wiki
输入框金额限制2位小数正则
var reg = /^(\d{1,})([.]{0,1})(\d{0,3})$/;
var money = $scope.cashmodel;
if (money.match(reg) == null && money !== "") {
$scope.cashmodel = "";
} else if (money !== "") {
if (money.indexOf(".") && money.length > money.indexOf(".") + 3) {
money = money.substring(0, money.indexOf(".") + 3);
$scope.cashmodel = money;
}
}