diff --git a/src/action-sheet/index.tsx b/src/action-sheet/index.tsx index f8846fe6c..cd64dba6f 100644 --- a/src/action-sheet/index.tsx +++ b/src/action-sheet/index.tsx @@ -21,7 +21,7 @@ export type ActionSheetItem = { export type ActionSheetProps = PopupMixinProps & { title?: string; - actions: ActionSheetItem[]; + actions?: ActionSheetItem[]; duration: number; cancelText?: string; closeOnClickAction?: boolean; @@ -126,7 +126,7 @@ function ActionSheet( {...inherit(ctx, true)} > {Header()} - {props.actions.map(Option)} + {props.actions && props.actions.map(Option)} {Content()} {CancelText()} @@ -137,14 +137,11 @@ ActionSheet.props = { ...PopupMixin.props, title: String, actions: Array, + duration: Number, cancelText: String, getContainer: [String, Function], closeOnClickAction: Boolean, safeAreaInsetBottom: Boolean, - duration: { - type: Number, - default: null - }, overlay: { type: Boolean, default: true diff --git a/src/address-edit/index.js b/src/address-edit/index.js index f1a0660f8..5b006ba7b 100644 --- a/src/address-edit/index.js +++ b/src/address-edit/index.js @@ -226,11 +226,11 @@ export default createComponent({ }, render(h) { - const { data, errorInfo } = this; + const { data, errorInfo, searchResult } = this; const onFocus = name => () => this.onFocus(name); // hide bottom field when use search && detail get focused - const hideBottomFields = this.searchResult.length && this.detailFocused; + const hideBottomFields = searchResult && searchResult.length && this.detailFocused; return (
diff --git a/src/address-list/index.tsx b/src/address-list/index.tsx index 987688811..bd8e75210 100644 --- a/src/address-list/index.tsx +++ b/src/address-list/index.tsx @@ -13,8 +13,8 @@ export type AddressListProps = { switchable: boolean; disabledText?: string; addButtonText?: string; - list: AddressItemData[]; - disabledList: AddressItemData[]; + list?: AddressItemData[]; + disabledList?: AddressItemData[]; }; export type AddressListSlots = DefaultSlots & { @@ -29,8 +29,12 @@ function AddressList( slots: AddressListSlots, ctx: RenderContext ) { - const getList = (list: AddressItemData[], disabled?: boolean) => - list.map((item, index) => ( + function renderList(list?: AddressItemData[], disabled?: boolean) { + if (!list) { + return; + } + + return list.map((item, index) => ( )); + } - const List = getList(props.list); - const DisabledList = getList(props.disabledList, true); + const List = renderList(props.list); + const DisabledList = renderList(props.disabledList, true); return (
@@ -59,9 +64,7 @@ function AddressList( > {List} - {props.disabledText && ( -
{props.disabledText}
- )} + {props.disabledText &&
{props.disabledText}
} {DisabledList} {slots.default && slots.default()}