From 6eb4b1b4783120e2a674dd76297f032ddfcd566e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sun, 11 Dec 2022 21:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=84=E4=BB=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MdpSelectDictX/index.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/components/MdpSelectDictX/index.vue b/src/components/MdpSelectDictX/index.vue index ccb2cae0..64b64699 100644 --- a/src/components/MdpSelectDictX/index.vue +++ b/src/components/MdpSelectDictX/index.vue @@ -43,11 +43,19 @@ export default { name: "mdp-select-dict-x", components: {}, computed: { - currentItem() { - if (this.dict) { - return this.dict.find((k) => k.id == this.myVal); - } else { - return null; + currentItem(){ + if(this.myVal===''||this.myVal===null){ + return {id:'',name:'无',className:'info'}; + } + if(this.dict){ + var item= this.dict.find(k=>k.id==this.myVal) + if(item){ + return item + }else{ + return {id:this.myVal,name:this.myVal,className:'info'} + } + }else{ + return {id:this.myVal,name:this.myVal,className:'info'}; } }, avaterCpd() {