diff --git a/pages/demo/form/input.uvue b/pages/demo/form/input.uvue
index ac2bb79..5d253d2 100644
--- a/pages/demo/form/input.uvue
+++ b/pages/demo/form/input.uvue
@@ -60,13 +60,15 @@
- 当 type 为 number 时,可设置 precision 属性来保留精度
+ 当 type 为 digit 时,可设置 precision 属性来保留精度
-
-
-
+
-
+
+
+
+
+
diff --git a/uni_modules/cool-ui/components/cl-input/cl-input.uvue b/uni_modules/cool-ui/components/cl-input/cl-input.uvue
index 04fd0eb..7c8cfb0 100644
--- a/uni_modules/cool-ui/components/cl-input/cl-input.uvue
+++ b/uni_modules/cool-ui/components/cl-input/cl-input.uvue
@@ -23,6 +23,7 @@
>
+
= 0 && value.value != "") {
+ if (props.type == "digit" && props.precision >= 0 && value.value != "") {
const parts = value.value.split(".");
return parts.length > 1 && parts[1].length > props.precision;
} else {
@@ -289,7 +290,7 @@ function onBlur(e: UniInputBlurEvent) {
emit("blur", e);
// 处理数字精度
- if (props.type == "number" && props.precision > 0 && value.value != "") {
+ if (props.type == "digit" && props.precision > 0 && value.value != "") {
const numValue = parseFloat(value.value);
if (!isNaN(numValue)) {
const formattedValue = numValue.toFixed(props.precision);