Skip to content

fix(Upload): listType="picture-card" showUploadList="false" disabled button visible #8191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions components/upload/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
import defaultLocale from '../locale/en_US';
import type { CSSProperties } from 'vue';
import { computed, defineComponent, onMounted, ref, toRef } from 'vue';
import { flattenChildren, initDefaultProps } from '../_util/props-util';
import { filterEmpty, flattenChildren, initDefaultProps } from '../_util/props-util';
import useMergedState from '../_util/hooks/useMergedState';
import devWarning from '../vc-util/devWarning';
import useConfigInject from '../config-provider/hooks/useConfigInject';
Expand Down Expand Up @@ -299,6 +299,9 @@ export default defineComponent({
defaultLocale.Upload,
computed(() => props.locale),
);
const HackSlot = (_, { slots }) => {
return filterEmpty(slots.default?.())[0];
};
const renderUploadList = (button?: () => VueNode, buttonVisible?: boolean) => {
const {
removeIcon,
Expand Down Expand Up @@ -340,7 +343,13 @@ export default defineComponent({
v-slots={{ ...slots }}
/>
) : (
button?.()
button ? (
<HackSlot
key="__ant_upload_appendAction"
v-show={!!buttonVisible}
v-slots={{ default: button }}
></HackSlot>
) : null
);
};
return () => {
Expand Down