Skip to content

Commit eda7247

Browse files
authored
fix: inject value maybe undefined && tag style invalid (#6320)
* fix: inject value maybe undefined * fix(tag): style invalid
1 parent f85485e commit eda7247

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

components/cascader/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ const Cascader = defineComponent({
323323
getTransitionDirection(placement.value),
324324
transitionName,
325325
)}
326-
getPopupContainer={getPopupContainer.value}
326+
getPopupContainer={getPopupContainer?.value}
327327
customSlots={{
328328
...slots,
329329
checkable: () => <span class={`${cascaderPrefixCls.value}-checkbox-inner`} />,

components/drawer/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const Drawer = defineComponent({
148148
const [wrapSSR, hashId] = useStyle(prefixCls);
149149
const getContainer = computed(() =>
150150
// 有可能为 false,所以不能直接判断
151-
props.getContainer === undefined && getPopupContainer.value
151+
props.getContainer === undefined && getPopupContainer?.value
152152
? () => getPopupContainer.value(document.body)
153153
: props.getContainer,
154154
);

components/image/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const Image = defineComponent<ImageProps>({
4343
});
4444

4545
return () => {
46-
const imageLocale = configProvider.locale.value?.Image || defaultLocale.Image;
46+
const imageLocale = configProvider.locale?.value?.Image || defaultLocale.Image;
4747
const defaultPreviewMask = () => (
4848
<div class={`${prefixCls.value}-mask-info`}>
4949
<EyeOutlined />

components/page-header/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const PageHeader = defineComponent({
5656
compact.value = width < 768;
5757
}
5858
};
59-
const ghost = computed(() => props.ghost ?? pageHeader.value?.ghost ?? true);
59+
const ghost = computed(() => props.ghost ?? pageHeader?.value?.ghost ?? true);
6060

6161
const getBackIcon = () => {
6262
return (

components/select/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ const Select = defineComponent({
266266
dropdownMatchSelectWidth={dropdownMatchSelectWidth}
267267
{...selectProps}
268268
{...attrs}
269-
showSearch={props.showSearch ?? select.value?.showSearch}
269+
showSearch={props.showSearch ?? select?.value?.showSearch}
270270
placeholder={placeholder}
271271
listHeight={listHeight}
272272
listItemHeight={listItemHeight}
@@ -279,7 +279,7 @@ const Select = defineComponent({
279279
clearIcon={clearIcon}
280280
notFoundContent={mergedNotFound}
281281
class={[mergedClassName.value, attrs.class]}
282-
getPopupContainer={getPopupContainer.value}
282+
getPopupContainer={getPopupContainer?.value}
283283
dropdownClassName={rcSelectRtlDropdownClassName}
284284
onChange={triggerChange}
285285
onBlur={handleBlur}

components/tag/index.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HTMLAttributes, App, PropType, ExtractPropTypes, Plugin } from 'vue';
1+
import type { HTMLAttributes, App, PropType, ExtractPropTypes, Plugin, CSSProperties } from 'vue';
22
import { ref, defineComponent, watchEffect, computed } from 'vue';
33
import classNames from '../_util/classNames';
44
import PropTypes from '../_util/vue-types';
@@ -133,7 +133,11 @@ const Tag = defineComponent({
133133
const isNeedWave = 'onClick' in attrs;
134134

135135
const tagNode = (
136-
<span {...attrs} class={tagClassName.value} style={tagStyle}>
136+
<span
137+
{...attrs}
138+
class={tagClassName.value}
139+
style={[tagStyle, attrs.style as CSSProperties]}
140+
>
137141
{kids}
138142
{renderCloseIcon()}
139143
</span>

components/tree-select/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ const TreeSelect = defineComponent({
314314
}
315315
showTreeIcon={treeIcon as any}
316316
notFoundContent={mergedNotFound}
317-
getPopupContainer={getPopupContainer.value}
317+
getPopupContainer={getPopupContainer?.value}
318318
treeMotion={null}
319319
dropdownClassName={mergedDropdownClassName.value}
320320
choiceTransitionName={choiceTransitionName.value}

0 commit comments

Comments
 (0)