From 0f08fda189892dd7970cd46ecc639e067509ed5b Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Tue, 14 Jul 2020 11:11:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20Tag=20=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E7=9A=84=20disabled=20=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/components/form/_tag.scss | 5 +++++ src/components/ResultBox.tsx | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scss/components/form/_tag.scss b/scss/components/form/_tag.scss index ba786937..855d4192 100644 --- a/scss/components/form/_tag.scss +++ b/scss/components/form/_tag.scss @@ -5,6 +5,11 @@ border-radius: 0; } + &-input.is-disabled { + border-style: dashed; + background: transparent; + } + &.is-inline { display: inline-block; } diff --git a/src/components/ResultBox.tsx b/src/components/ResultBox.tsx index 6ab81481..9e9b794a 100644 --- a/src/components/ResultBox.tsx +++ b/src/components/ResultBox.tsx @@ -128,7 +128,7 @@ export class ResultBox extends React.Component { onResultClick ? 'is-clickable' : '' )} onClick={onResultClick} - tabIndex={!allowInput && onFocus ? 0 : -1} + tabIndex={!allowInput && !disabled && onFocus ? 0 : -1} onKeyPress={allowInput ? undefined : onKeyPress} onFocus={allowInput ? undefined : onFocus} onBlur={allowInput ? undefined : onBlur} @@ -139,20 +139,22 @@ export class ResultBox extends React.Component { {itemRender(item)} - - - + {!disabled ? ( + + + + ) : null} )) ) : result && !Array.isArray(result) ? ( {result} - ) : allowInput ? null : ( + ) : allowInput && !disabled ? null : ( {__(placeholder || '无')} )} - {allowInput ? ( + {allowInput && !disabled ? (