Skip to content

[bug]: 3.0.0版本,vue3 + vue-cli5.x,无法正常预览 docx 文件, doc 正常 #248

Description

@io-o

Affected area

Framework component or public API

File type and extension

docx

Package names and exact versions

"@file-viewer/vue3": "3.0.0", "@file-viewer/preset-office": "3.0.0",

Sample sharing method

Public or sanitized sample attached to this issue

Sample or reproduction artifact

本地启动报错
Image

使用接口获取文件流,然后 new File() 传入, doc 格式正常渲染,docx 一直再解析, 这个 docx 文件在官网 demo上传可以解析。
Image

Minimal reproduction steps

{{ previewTitle }}

<script setup lang="ts"> import { ref } from 'vue' import { FileViewer } from '@file-viewer/vue3' import officePreset from '@file-viewer/preset-office' import { downloadAttach } from '../api' interface PreviewAttachment { fileCode: string fileName: string } const options = { preset: officePreset, rendererMode: 'replace', theme: 'light', styleIsolation: 'shadow', toolbar: false } const drawer = ref(false) const previewTitle = ref('附件预览') const file = ref() const open = async (item: PreviewAttachment) => { const fileName = item.fileName.trim() drawer.value = true previewTitle.value = fileName try { const response: any = await downloadAttach(item.fileCode) file.value = new File([response], fileName, { type: response.type }) } catch { file.value = undefined } } const handlePreviewClosed = () => { file.value = undefined } defineExpose({ open }) </script>

Actual behavior

Expected behavior

能正常渲染

Environment

chrome 151.0.7922.174, macos 26

Regression status

Worked in an earlier File Viewer version

Screenshots or recordings

No response

Console and network evidence

n/a

Required confirmations

  • I searched existing issues and did not find the same reproduction.
  • I have already attached, linked, or privately sent the sample using the selected method.
  • I understand that screenshots and renamed file extensions do not replace a real sample or runnable reproduction.
  • Any public attachment is sanitized and safe to redistribute for regression testing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus:needs-sampleA source or reduced reproduction file is required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions