@koi-br/ocr-web-sdk 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-CqSyQjJ2.mjs → index-BUW0_Hv2.mjs} +8891 -8805
- package/dist/{index-BHtQ-val.js → index-DxvQQd3Y.js} +81 -81
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/{tiff.min-D0RfnjXu.js → tiff.min-BDrWBfNI.js} +1 -1
- package/dist/{tiff.min-q16GulNm.mjs → tiff.min-DFX5shSB.mjs} +1 -1
- package/package.json +1 -1
- package/preview/ImagePreview.vue +644 -428
- package/preview/index.vue +19 -5
package/preview/index.vue
CHANGED
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</template>
|
|
132
132
|
|
|
133
133
|
<script setup>
|
|
134
|
-
import { ref, onBeforeUnmount, computed } from 'vue';
|
|
134
|
+
import { ref, onBeforeUnmount, computed, watch } from 'vue';
|
|
135
135
|
import { Message, Button as AButton } from '@arco-design/web-vue';
|
|
136
136
|
import ImagePreview from './ImagePreview.vue';
|
|
137
137
|
import PdfPreview from './PdfPreview.vue';
|
|
@@ -212,6 +212,20 @@ const imagePreviewUrl = computed(() => {
|
|
|
212
212
|
return fileUrl.value;
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
+
// 监听 imageProps 的变化,自动设置 fileType
|
|
216
|
+
watch(
|
|
217
|
+
() => props.imageProps?.url || props.imageProps?.urls,
|
|
218
|
+
(newUrl) => {
|
|
219
|
+
if (newUrl) {
|
|
220
|
+
// 如果传入了图片URL,自动设置fileType为image
|
|
221
|
+
if (fileType.value !== 'image') {
|
|
222
|
+
fileType.value = 'image';
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
{ immediate: true }
|
|
227
|
+
);
|
|
228
|
+
|
|
215
229
|
// 添加 AbortController 的引用
|
|
216
230
|
const abortController = ref(null);
|
|
217
231
|
|
|
@@ -474,9 +488,9 @@ defineExpose({
|
|
|
474
488
|
if (fileType.value === 'pdf' && pdfPreviewRef.value) {
|
|
475
489
|
return pdfPreviewRef.value.jumpToPosition(pageNum, bbox, emitEvent);
|
|
476
490
|
}
|
|
477
|
-
//
|
|
491
|
+
// 图片预览的定位方法(现在也支持 pageNum)
|
|
478
492
|
if (fileType.value === 'image' && imagePreviewRef.value) {
|
|
479
|
-
return imagePreviewRef.value.jumpToPosition(bbox, emitEvent);
|
|
493
|
+
return imagePreviewRef.value.jumpToPosition(pageNum, bbox, emitEvent);
|
|
480
494
|
}
|
|
481
495
|
},
|
|
482
496
|
getCurrentPage: () => pdfPreviewRef.value?.getCurrentPage(),
|
|
@@ -484,8 +498,8 @@ defineExpose({
|
|
|
484
498
|
// 图片预览的代理方法
|
|
485
499
|
resetImage: () => imagePreviewRef.value?.reset(),
|
|
486
500
|
resetTif: () => tifPreviewRef.value?.reset(),
|
|
487
|
-
//
|
|
488
|
-
jumpToImagePosition: (bbox, emitEvent) => imagePreviewRef.value?.jumpToPosition(bbox, emitEvent),
|
|
501
|
+
// 图片预览的定位方法(已废弃,请使用 jumpToPosition,需要传入 pageNum)
|
|
502
|
+
jumpToImagePosition: (pageNum, bbox, emitEvent) => imagePreviewRef.value?.jumpToPosition(pageNum, bbox, emitEvent),
|
|
489
503
|
});
|
|
490
504
|
|
|
491
505
|
// 组件销毁时清理资源
|