Merge remote-tracking branch 'origin/main' into feat-v4
commit
23a213acda
|
@ -81,6 +81,7 @@ const ImageInternal = defineComponent({
|
||||||
? mergeDefaultValue(props.preview, defaultValues)
|
? mergeDefaultValue(props.preview, defaultValues)
|
||||||
: defaultValues;
|
: defaultValues;
|
||||||
});
|
});
|
||||||
|
const src = computed(() => preview.value.src ?? props.src);
|
||||||
const isCustomPlaceholder = computed(
|
const isCustomPlaceholder = computed(
|
||||||
() => (props.placeholder && props.placeholder !== true) || slots.placeholder,
|
() => (props.placeholder && props.placeholder !== true) || slots.placeholder,
|
||||||
);
|
);
|
||||||
|
@ -171,14 +172,14 @@ const ImageInternal = defineComponent({
|
||||||
let unRegister = () => {};
|
let unRegister = () => {};
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
watch(
|
watch(
|
||||||
[() => props.src, canPreview],
|
[src, canPreview],
|
||||||
() => {
|
() => {
|
||||||
unRegister();
|
unRegister();
|
||||||
if (!isPreviewGroup.value) {
|
if (!isPreviewGroup.value) {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
unRegister = registerImage(currentId.value, props.src, canPreview.value);
|
unRegister = registerImage(currentId.value, src.value, canPreview.value);
|
||||||
|
|
||||||
if (!canPreview.value) {
|
if (!canPreview.value) {
|
||||||
unRegister();
|
unRegister();
|
||||||
|
@ -216,12 +217,12 @@ const ImageInternal = defineComponent({
|
||||||
class: cls,
|
class: cls,
|
||||||
style,
|
style,
|
||||||
} = attrs as ImgHTMLAttributes;
|
} = attrs as ImgHTMLAttributes;
|
||||||
const { icons, maskClassName, src: previewSrc, ...dialogProps } = preview.value;
|
const { icons, maskClassName, ...dialogProps } = preview.value;
|
||||||
|
|
||||||
const wrappperClass = cn(prefixCls, wrapperClassName, rootClassName, {
|
const wrappperClass = cn(prefixCls, wrapperClassName, rootClassName, {
|
||||||
[`${prefixCls}-error`]: isError.value,
|
[`${prefixCls}-error`]: isError.value,
|
||||||
});
|
});
|
||||||
const mergedSrc = isError.value && fallback ? fallback : previewSrc ?? imgSrc;
|
const mergedSrc = isError.value && fallback ? fallback : src.value;
|
||||||
const imgCommonProps = {
|
const imgCommonProps = {
|
||||||
crossorigin,
|
crossorigin,
|
||||||
decoding,
|
decoding,
|
||||||
|
|
Loading…
Reference in New Issue