Commit 0e90bf24 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复展示状态下地址报错的问题

parent 2dd6ca3f
...@@ -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-08-19 17:23:30 * @LastEditTime: 2021-08-26 09:47:51
* @Description: 地址选择 FormItem * @Description: 地址选择 FormItem
*/ */
import React, { useState, useEffect, useMemo, useRef } from 'react'; import React, { useState, useEffect, useMemo, useRef } from 'react';
...@@ -464,12 +464,14 @@ const AddressSelect: React.FC<IProps> = (props) => { ...@@ -464,12 +464,14 @@ const AddressSelect: React.FC<IProps> = (props) => {
})); }));
}, [list]); }, [list]);
if (!editable) { if (!editable && value) {
console.log('list', list)
const current = list.find((item) => item.id === value); const current = list.find((item) => item.id === value);
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';
return ( return (
<div>{full || 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