Commit f420bfc1 authored by XieZhiXiong's avatar XieZhiXiong

chore: 增强判断

parent bc466830
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: XieZhiXiong * @Author: XieZhiXiong
* @Date: 2021-08-05 10:28:06 * @Date: 2021-08-05 10:28:06
* @LastEditors: XieZhiXiong * @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-10 10:27:19 * @LastEditTime: 2021-09-17 15:48:16
* @Description: 地址选择 FormItem * @Description: 地址选择 FormItem
*/ */
import React, { useState, useEffect, useMemo, useRef } from 'react'; import React, { useState, useEffect, useMemo, useRef } from 'react';
...@@ -491,12 +491,12 @@ const AddressSelect: React.FC<IProps> = (props) => { ...@@ -491,12 +491,12 @@ const AddressSelect: React.FC<IProps> = (props) => {
}, [list]); }, [list]);
if (!editable) { if (!editable) {
const current = list.find((item) => item.id === value.id); const current = list.find((item) => item.id === value?.id);
const full = current ? `${current.name} ${current.fullAddress} ${current.phone}` : null; const full = current ? `${current.name} ${current.fullAddress} ${current.phone}` : null;
const isStr = typeof value === 'string'; const isStr = typeof value === 'string';
return ( return (
<div>{full || (!isStr ? `${value.name} ${value.fullAddress} ${value.phone}` : value)}</div> <div>{full || (!isStr ? `${value?.name || ''} ${value?.fullAddress || ''} ${value?.phone || ''}` : value)}</div>
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment