From 31c6ec6e87860e6c9ace7aae6a2492ecdc0366ab Mon Sep 17 00:00:00 2001 From: 2betop <2betop.cn@gmail.com> Date: Wed, 15 Jan 2020 15:09:25 +0800 Subject: [PATCH] =?UTF-8?q?select=20=E6=94=AF=E6=8C=81=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E7=BA=A7=E5=88=AB=20disabled=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scss/components/form/_select.scss | 8 ++++++++ src/components/Select.tsx | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scss/components/form/_select.scss b/scss/components/form/_select.scss index c1fcaafb..ddb3de35 100644 --- a/scss/components/form/_select.scss +++ b/scss/components/form/_select.scss @@ -100,6 +100,14 @@ &:hover { background-color: darken($Form-selectValue-bg, 5%); } + + &.is-disabled { + pointer-events: none; + display: none; + cursor: not-allowed; + background-color: lighten($Form-selectValue-bg, 5%); + background: lighten($Form-selectValue-bg, 5%); + } } &-arrow { diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 67643e0f..fb384ece 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -542,7 +542,9 @@ export class Select extends React.Component { multiple ? (
× @@ -694,6 +696,7 @@ export class Select extends React.Component { onChange={() => { this.handleChange(item); }} + disabled={item.disabled} > {item.disabled ? item[labelField]