@@ -55,10 +55,7 @@ const showOverlay = ref<boolean>(false);
5555const localUrl = ref <string >();
5656const bgColor = ref <string >(" transparent" );
5757
58- const oriUrl = computed <string >(() => {
59- if (typeof props .data .insert .image === " string" ) return props .data .insert .image ;
60- return props .data .insert .image .url ;
61- });
58+ const oriUrl = ref <string >(" " );
6259const imgExt = computed <string >(() => getImageExt ());
6360const showOri = ref <boolean >(imgExt .value === " gif" || imageQualityPercent .value === 100 );
6461
@@ -71,6 +68,7 @@ const imgWidth = computed<string>(() => {
7168console .log (" tp-image" , props .data .insert .image , props .data .attributes );
7269
7370onMounted (async () => {
71+ oriUrl .value = miniImgUrl ();
7472 const link = appStore .getImageUrl (oriUrl .value , imgExt .value );
7573 localUrl .value = await saveImgLocal (link );
7674});
@@ -93,6 +91,17 @@ onUnmounted(() => {
9391 if (localUrl .value ) URL .revokeObjectURL (localUrl .value );
9492});
9593
94+ function miniImgUrl(): string {
95+ let url: string ;
96+ if (typeof props .data .insert .image === " string" ) {
97+ url = props .data .insert .image ;
98+ } else {
99+ url = props .data .insert .image .url ;
100+ }
101+ const link = new URL (url );
102+ return ` ${link .origin }${link .pathname } ` ;
103+ }
104+
96105function getImageTitle(): string {
97106 const res: string [] = [];
98107 if (props .data .attributes ) {
0 commit comments