From 7e7f06ed96d49c59a944720c2781e95ec00a7a76 Mon Sep 17 00:00:00 2001 From: Tevin <tingquanren@163.com> Date: Wed, 23 Mar 2022 18:31:54 +0800 Subject: [PATCH] CSwitchRadio增加左对齐模式 --- forms/switch/cSwitch.scss | 10 ++++++++++ forms/switch/CSwitchRadio.vue | 10 ++++++++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/forms/switch/CSwitchRadio.vue b/forms/switch/CSwitchRadio.vue index 93feb20..b82eb85 100644 --- a/forms/switch/CSwitchRadio.vue +++ b/forms/switch/CSwitchRadio.vue @@ -51,10 +51,17 @@ props: { // 表单数据资源(表单组件内部机制专用) itemRes: Object, + // 选项对齐方式,left / right(默认) + checkAlign: { + type: String, + default: 'right', + }, + // 选中文字 checkedLabel: { type: String, default: '是', }, + // 不选中文字 uncheckedLabel: { type: String, default: '否', @@ -66,6 +73,9 @@ computed: { className() { let className = ''; + if (this.checkAlign === 'left') { + className += 'c-switch-radio-left '; + } if (this.itemRes.required) { className += 'c-switch-required '; } diff --git a/forms/switch/cSwitch.scss b/forms/switch/cSwitch.scss index 0777689..a36b56f 100644 --- a/forms/switch/cSwitch.scss +++ b/forms/switch/cSwitch.scss @@ -74,4 +74,14 @@ padding-left: 6px; } } + &.c-switch-radio-left { + .c-switch-radio-group { + width: 538px; + padding-right: 0; + .c-switch-radio-item { + padding-left: 0; + padding-right: 22px; + } + } + } } \ No newline at end of file -- Gitblit v1.9.1