From 1aea60d64276ab2b960e21ca3fc5716ff89dc7fe Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Thu, 30 Mar 2023 18:00:41 +0800 Subject: [PATCH] 优化跨端通讯协议,支持超时自动释放资源,支持异常通讯拦截 --- forms/switch/CSwitch.vue | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/forms/switch/CSwitch.vue b/forms/switch/CSwitch.vue index 6171b54..9d459d9 100644 --- a/forms/switch/CSwitch.vue +++ b/forms/switch/CSwitch.vue @@ -4,11 +4,12 @@ */ <template> - <view :class="['c-switch', className]"> + <view :class="['c-switch', className, readOnly?'read-only':'']"> <AtSwitch - :title="itemData.label" - :checked="itemData.formData[itemData.name]" - :onChange="evt=>itemData.onChange(evt)" + :title="itemRes.label" + :checked="itemRes.formData[itemRes.name]" + :disabled="readOnly" + :onChange="evt=>itemRes.onChange(evt)" /> </view> </template> @@ -21,7 +22,13 @@ name: 'CSwitch', components: { AtSwitch }, props: { - itemData: Object, + // 表单数据资源(表单组件内部机制专用) + itemRes: Object, + // 只读模式 + readOnly: { + type: Boolean, + default: false, + }, }, data() { return {}; @@ -29,10 +36,10 @@ computed: { className() { let className = ''; - if (this.itemData.required) { + if (this.itemRes.required) { className += 'c-switch-required '; } - if (this.itemData.error) { + if (this.itemRes.error) { className += 'c-switch-error '; } return className; -- Gitblit v1.9.1