From eda7247c2c11697f58be57996eacc72b75405ff4 Mon Sep 17 00:00:00 2001 From: zkwolf Date: Tue, 28 Feb 2023 21:57:11 +0800 Subject: [PATCH] fix: inject value maybe undefined && tag style invalid (#6320) * fix: inject value maybe undefined * fix(tag): style invalid --- components/cascader/index.tsx | 2 +- components/drawer/index.tsx | 2 +- components/image/index.tsx | 2 +- components/page-header/index.tsx | 2 +- components/select/index.tsx | 4 ++-- components/tag/index.tsx | 8 ++++++-- components/tree-select/index.tsx | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index 29adf450f..e79a675cf 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -323,7 +323,7 @@ const Cascader = defineComponent({ getTransitionDirection(placement.value), transitionName, )} - getPopupContainer={getPopupContainer.value} + getPopupContainer={getPopupContainer?.value} customSlots={{ ...slots, checkable: () => , diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index 7cc8ad717..f3811ed9a 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -148,7 +148,7 @@ const Drawer = defineComponent({ const [wrapSSR, hashId] = useStyle(prefixCls); const getContainer = computed(() => // 有可能为 false,所以不能直接判断 - props.getContainer === undefined && getPopupContainer.value + props.getContainer === undefined && getPopupContainer?.value ? () => getPopupContainer.value(document.body) : props.getContainer, ); diff --git a/components/image/index.tsx b/components/image/index.tsx index 10f303046..0e752b486 100644 --- a/components/image/index.tsx +++ b/components/image/index.tsx @@ -43,7 +43,7 @@ const Image = defineComponent({ }); return () => { - const imageLocale = configProvider.locale.value?.Image || defaultLocale.Image; + const imageLocale = configProvider.locale?.value?.Image || defaultLocale.Image; const defaultPreviewMask = () => (
diff --git a/components/page-header/index.tsx b/components/page-header/index.tsx index 40e8bfcdb..5de97b6ec 100644 --- a/components/page-header/index.tsx +++ b/components/page-header/index.tsx @@ -56,7 +56,7 @@ const PageHeader = defineComponent({ compact.value = width < 768; } }; - const ghost = computed(() => props.ghost ?? pageHeader.value?.ghost ?? true); + const ghost = computed(() => props.ghost ?? pageHeader?.value?.ghost ?? true); const getBackIcon = () => { return ( diff --git a/components/select/index.tsx b/components/select/index.tsx index d4cbf7be9..4d86638fd 100644 --- a/components/select/index.tsx +++ b/components/select/index.tsx @@ -266,7 +266,7 @@ const Select = defineComponent({ dropdownMatchSelectWidth={dropdownMatchSelectWidth} {...selectProps} {...attrs} - showSearch={props.showSearch ?? select.value?.showSearch} + showSearch={props.showSearch ?? select?.value?.showSearch} placeholder={placeholder} listHeight={listHeight} listItemHeight={listItemHeight} @@ -279,7 +279,7 @@ const Select = defineComponent({ clearIcon={clearIcon} notFoundContent={mergedNotFound} class={[mergedClassName.value, attrs.class]} - getPopupContainer={getPopupContainer.value} + getPopupContainer={getPopupContainer?.value} dropdownClassName={rcSelectRtlDropdownClassName} onChange={triggerChange} onBlur={handleBlur} diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 04073c70e..208386c4e 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -1,4 +1,4 @@ -import type { HTMLAttributes, App, PropType, ExtractPropTypes, Plugin } from 'vue'; +import type { HTMLAttributes, App, PropType, ExtractPropTypes, Plugin, CSSProperties } from 'vue'; import { ref, defineComponent, watchEffect, computed } from 'vue'; import classNames from '../_util/classNames'; import PropTypes from '../_util/vue-types'; @@ -133,7 +133,11 @@ const Tag = defineComponent({ const isNeedWave = 'onClick' in attrs; const tagNode = ( - + {kids} {renderCloseIcon()} diff --git a/components/tree-select/index.tsx b/components/tree-select/index.tsx index 0760d5b68..064ac32b3 100644 --- a/components/tree-select/index.tsx +++ b/components/tree-select/index.tsx @@ -314,7 +314,7 @@ const TreeSelect = defineComponent({ } showTreeIcon={treeIcon as any} notFoundContent={mergedNotFound} - getPopupContainer={getPopupContainer.value} + getPopupContainer={getPopupContainer?.value} treeMotion={null} dropdownClassName={mergedDropdownClassName.value} choiceTransitionName={choiceTransitionName.value}