From 17992a8ff38847414097c0899f86257a0e52f643 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Tue, 12 Apr 2022 18:00:20 +0800
Subject: [PATCH] 输入框,增加只读模式

---
 forms/input/CInput.vue  |    7 ++++++-
 forms/input/cInput.scss |    4 ++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/forms/input/CInput.vue b/forms/input/CInput.vue
index 74d986e..ca251f7 100644
--- a/forms/input/CInput.vue
+++ b/forms/input/CInput.vue
@@ -6,7 +6,7 @@
 <template>
     <view
         class="c-input"
-        :class="unit?'c-input-unit':''"
+        :class="[unit?'c-input-unit':'', readOnly ? 'read-only':'']"
     >
         <AtInput
             :name="itemRes.name"
@@ -46,6 +46,11 @@
         placeholder: String,
         // 输入框单位
         unit: String,
+        // 只读模式
+        readOnly: {
+            type: Boolean,
+            default: false,
+        },
     },
     computed: {
         value() {
diff --git a/forms/input/cInput.scss b/forms/input/cInput.scss
index e785b9c..d8d2d39 100644
--- a/forms/input/cInput.scss
+++ b/forms/input/cInput.scss
@@ -6,6 +6,10 @@
 @import "../../common/sassMixin";
 
 .c-input {
+    &.read-only {
+        pointer-events: none;
+        background-color: #fafafa;
+    }
     .at-input__icon {
         display: none;
     }

--
Gitblit v1.9.1