sh-view 2.7.7 → 2.7.8
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.
|
@@ -30,12 +30,21 @@ export default defineComponent({
|
|
|
30
30
|
emits: ['ready', 'error'],
|
|
31
31
|
setup(props, context) {
|
|
32
32
|
const { emit, slots } = context
|
|
33
|
-
const previewType = computed(() =>
|
|
33
|
+
const previewType = computed(() => {
|
|
34
|
+
if (props.type) {
|
|
35
|
+
return props.type.toLowerCase()
|
|
36
|
+
} else if (props.url) {
|
|
37
|
+
return props.url.substr(props.url.lastIndexOf('.') + 1).toLowerCase()
|
|
38
|
+
}
|
|
39
|
+
return ''
|
|
40
|
+
})
|
|
34
41
|
const componentName = computed(() => {
|
|
35
|
-
if (
|
|
42
|
+
if (!props.url || !previewType.value) {
|
|
43
|
+
return 'div'
|
|
44
|
+
} else if (['word', 'doc', 'docx'].includes(previewType.value)) {
|
|
36
45
|
return defineAsyncComponent(() => import('./components/sh-word.vue'))
|
|
37
46
|
} else if (['excel', 'xlsx'].includes(previewType.value)) {
|
|
38
|
-
|
|
47
|
+
return defineAsyncComponent(() => import('./components/sh-excel.vue'))
|
|
39
48
|
}
|
|
40
49
|
return 'iframe'
|
|
41
50
|
})
|