xiongzhu 5 years ago
parent
commit
e6b7a49d06

+ 25 - 0
src/native/components/ctextarea/index.js

@@ -0,0 +1,25 @@
+Component({
+    properties: {
+        placeholder: { type: String, value: '' },
+        placeholderStyle: { type: String, value: '' },
+        placeholderClass: { type: String, value: '' },
+        disabled: { type: Boolean, value: false },
+        autoFocus: { type: Boolean, value: false },
+        focus: { type: Boolean, value: false },
+        autoHeight: { type: Boolean, value: false },
+        fixed: { type: Boolean, value: false },
+        cursorSpacing: { type: Number | String, value: 0 },
+        cursor: { type: Number, value: 0 },
+        showConfirmBar: { type: Boolean, value: true },
+        selectionStart: { type: Number, value: -1 },
+        selectionEnd: { type: Number, value: -1 },
+        adjustPosition: { type: Boolean, value: true },
+        maxlength: { type: Number, value: 140 },
+        value: { type: String, value: '' }
+    },
+    methods: {
+        proxy(e) {
+            this.triggerEvent(e.type, e.detail);
+        }
+    }
+});

+ 3 - 0
src/native/components/ctextarea/index.json

@@ -0,0 +1,3 @@
+{
+    "component": true
+}

+ 26 - 0
src/native/components/ctextarea/index.wxml

@@ -0,0 +1,26 @@
+<textarea
+  class="custom-textarea"
+  placeholder="{{placeholder}}"
+  placeholder-style="{{placeholderStyle}}"
+  placeholder-class="{{placeholderClass}}"
+  disabled="{{disabled}}"
+  auto-focus="{{autoFocus}}"
+  focus="{{focus}}"
+  auto-height="{{autoHeight}}"
+  fixed="{{fixed}}"
+  cursor-spacing="{{cursorSpacing}}"
+  cursor="{{cursor}}"
+  show-confirm-bar="{{showConfirmBar}}"
+  selection-start="{{selectionStart}}"
+  selection-end="{{selectionEnd}}"
+  adjust-position="{{adjustPosition}}"
+  maxlength="{{maxlength}}"
+  value="{{value}}"
+
+  bindinput="proxy"
+  bindblur="proxy"
+  bindfocus="proxy"
+  bindblur="proxy"
+  bindlinechange="proxy"
+>
+</textarea>

+ 10 - 0
src/native/components/ctextarea/index.wxss

@@ -0,0 +1,10 @@
+.custom-textarea {
+    width: inherit;
+    height: inherit;
+    display: inherit;
+    position: inherit;
+}
+.placeholder {
+    color: #c6c8cc;
+    font-size: 14px;
+}

+ 19 - 14
src/pages/report.vue

@@ -4,18 +4,24 @@
     "navigationBarTitleText": "问题反馈",
     "navigationBarBackgroundColor": "#ffffff",
     "navigationBarTextStyle": "black",
-    "backgroundColor": "#ffffff"
+    "backgroundColor": "#ffffff",
+    "usingComponents": {
+        "ctextarea": "/native/components/ctextarea/index"
+    }
 }
 </config>
 <template>
     <div class="page-container">
         <div class="page-scroll">
-            <textarea
-                v-model="desc"
-                :maxlength="200"
-                placeholder="请输入您的问题,200字以内"
-                placeholder-class="placeholder"
-            />
+            <div class="textarea-wrapper">
+                <ctextarea
+                    class="ctextarea"
+                    @input="desc = $event.detail.value"
+                    :maxlength="200"
+                    placeholder="请输入您的问题,200字以内"
+                    placeholder-class="placeholder"
+                />
+            </div>
             <img class="pic" :src="img" @click="chooseImg" v-if="img" mode="aspectFill" />
             <div class="pic" @click="chooseImg" v-else>
                 <img src="../static/imgs/icon_pic.png" />
@@ -103,14 +109,13 @@ export default {
 page {
     background: white;
 }
-.placeholder {
-    color: @text4;
-    font-size: 14px;
+.textarea-wrapper {
+    padding: 16px 16px 0 16px;
 }
-textarea {
-    font-size: 14px;
-    color: black;
-    margin: 16px;
+.ctextarea {
+    display: block;
+    width: 100%;
+    height: 140px;
     border-bottom: 1px solid @border2;
 }
 .pic {