From 4e10584d477c0fd5da7e3a7164ca04df795a4936 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Wed, 29 Jun 2022 10:47:54 +0800 Subject: [PATCH] 主机类型管理,缓存主动设定的主机类型,并在下次优先使用 --- forms/input/CInput.vue | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/forms/input/CInput.vue b/forms/input/CInput.vue index 95f98ff..d23c616 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,15 +46,24 @@ placeholder: String, // 输入框单位 unit: String, + // 只读模式 + readOnly: { + type: Boolean, + default: false, + }, }, computed: { value() { - return (itemRes.formData[itemRes.name] || '').replace(/[\n\r]/g, ''); + return ((this.itemRes.formData[this.itemRes.name] || '') + '').replace( + /[\n\r]/g, + '' + ); }, }, methods: { hanldeChange(evt) { - const changeValue = (evt || '').replace(/[\n\r]/g, ''); + // 小程序中,可以粘贴换行符进来 + const changeValue = ((evt || '') + '').replace(/[\n\r]/g, ''); this.itemRes.onChange(changeValue); }, }, -- Gitblit v1.9.1