From 704712b7d59aeb0dfc275e8b7ef9675dc34828c1 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Thu, 11 Nov 2021 09:52:01 +0800 Subject: [PATCH] 优化跨端通讯Api使用体验 --- forms/input/CInput.vue | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git a/forms/input/CInput.vue b/forms/input/CInput.vue index c09081c..171f765 100644 --- a/forms/input/CInput.vue +++ b/forms/input/CInput.vue @@ -1,25 +1,35 @@ /** - * CInput + * CInput - 表单项,文本输入框 * @author Tevin */ <template> - <AtInput - :name="itemData.name" - :title="itemData.label" - :type="type" - :placeholder="placeholder" - :required="itemData.required" - :error="itemData.error" - :value="itemData.formData[itemData.name]" - :onChange="evt=>itemData.onChange(evt)" + <view + class="c-input" + :class="unit?'c-input-unit':''" > - <slot /> - </AtInput> + <AtInput + :name="itemRes.name" + :title="itemRes.label" + :type="type" + :placeholder="placeholder" + :required="itemRes.required" + :error="itemRes.error" + :value="itemRes.formData[itemRes.name]" + :onChange="evt=>itemRes.onChange(evt)" + > + <slot v-if="!unit" /> + <text + class="c-input-unit-text" + v-if="unit" + >{{unit}}</text> + </AtInput> + </view> </template> <script> import { AtInput } from 'taro-ui-vue'; +import './cInput.scss'; export default { name: 'CInput', @@ -27,9 +37,15 @@ AtInput, }, props: { + // 表单数据资源(表单组件内部机制专用) + itemRes: Object, + // 输入框类型,text、number、password、phone、idcard、digit type: String, + // 占位提示 placeholder: String, - itemData: Object, + // 输入框单位 + unit: String, }, + mounted() {}, }; </script> \ No newline at end of file -- Gitblit v1.9.1