From c3206ec5f49d0936cd41df5b485631780cc2e15e Mon Sep 17 00:00:00 2001 From: "sin-ning@aliyun.com" Date: Mon, 27 May 2019 00:23:22 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20DictionarySelect=20def?= =?UTF-8?q?aultValue=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Dictionary/DictionarySelect.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/admin-web/src/components/Dictionary/DictionarySelect.js b/admin-web/src/components/Dictionary/DictionarySelect.js index 358fbf525..7c4ba54d0 100644 --- a/admin-web/src/components/Dictionary/DictionarySelect.js +++ b/admin-web/src/components/Dictionary/DictionarySelect.js @@ -4,11 +4,15 @@ import DictionaryContext from './DictionaryContext'; export default class DictionarySelect extends PureComponent { renderSelect(children) { - // eslint-disable-next-line react/destructuring-assignment // const { initialValue } = this.props['data-__meta']; - const propsX = this.props; - if (propsX.defaultValue === 'undefined' || propsX.defaultValue === 'null') { - propsX.defaultValue = undefined; + const propsX = { + ...this.props, + }; + if (propsX.value !== undefined || propsX.value !== null) { + propsX.value = `${propsX.value}`; + } + if (propsX.value === 'undefined' || propsX.value === 'null') { + delete propsX.value; } return ; }