@jrchan/office-preview 1.0.4 → 1.0.6
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/README.md +274 -12
- package/dist/office-preview.css +1 -1
- package/dist/office-preview.es.js +1 -2
- package/dist/office-preview.umd.js +1 -2
- package/package.json +6 -8
- package/dist/App.vue.d.ts +0 -2
- package/dist/example.es.js +0 -53
- package/dist/example.es.js.map +0 -1
- package/dist/example.umd.js +0 -2
- package/dist/example.umd.js.map +0 -1
- package/dist/main.d.ts +0 -0
- package/dist/npm-package-name.css +0 -1
- package/dist/office-preview.es.js.map +0 -1
- package/dist/office-preview.umd.js.map +0 -1
- package/dist/src/App.vue.d.ts +0 -2
- package/dist/src/App.vue.js +0 -53
- package/dist/src/App.vue.js.map +0 -1
- package/dist/src/components/office-preview.vue.d.ts +0 -15
- package/dist/src/components/office-preview.vue.js +0 -103
- package/dist/src/components/office-preview.vue.js.map +0 -1
- package/dist/src/index.d.ts +0 -14
- package/dist/src/index.js +0 -20
- package/dist/src/index.js.map +0 -1
- package/dist/src/main.d.ts +0 -1
- package/dist/src/main.js +0 -5
- package/dist/src/main.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vite.config.d.ts +0 -2
- package/dist/vite.config.js +0 -53
- package/dist/vite.config.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,25 +1,287 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Office Preview 组件
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于 Vue 3 的在线文档预览组件,支持 docx、pptx、excel、pdf 等格式。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## ⚠️ 重要说明
|
|
6
|
+
|
|
7
|
+
**本组件是一个纯粹的 UI 组件,不包含任何测试数据或硬编码的文件 URL。**
|
|
8
|
+
|
|
9
|
+
- ✅ `App.vue` 仅用于本地开发调试,**不会被打包到 npm 包中**
|
|
10
|
+
- ✅ 使用方项目必须自己传入 `file-url` 和 `file-type` 参数
|
|
11
|
+
- ✅ 组件不会主动加载任何测试文件
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @jrchan/office-preview
|
|
7
17
|
```
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
## 使用方法
|
|
10
20
|
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
### 方式一:全局注册(推荐)
|
|
22
|
+
|
|
23
|
+
**main.ts**
|
|
24
|
+
```typescript
|
|
25
|
+
import { createApp } from 'vue'
|
|
26
|
+
import App from './App.vue'
|
|
27
|
+
import OfficePreview from '@jrchan/office-preview'
|
|
28
|
+
|
|
29
|
+
const app = createApp(App)
|
|
30
|
+
app.use(OfficePreview)
|
|
31
|
+
app.mount('#app')
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**在组件中使用**
|
|
35
|
+
```vue
|
|
36
|
+
<template>
|
|
37
|
+
<div class="app">
|
|
38
|
+
<!-- ✅ 必须传入 file-url 和 file-type -->
|
|
39
|
+
<OfficePreview
|
|
40
|
+
:file-url="myFileUrl"
|
|
41
|
+
:file-type="myFileType"
|
|
42
|
+
@rendered="handleRendered"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { ref } from 'vue'
|
|
49
|
+
|
|
50
|
+
// ✅ 使用方自己提供文件 URL(可以是 HTTP/HTTPS 地址或 Blob URL)
|
|
51
|
+
const myFileUrl = ref('https://your-server.com/files/document.docx')
|
|
52
|
+
const myFileType = ref('docx')
|
|
53
|
+
|
|
54
|
+
const handleRendered = (type: string) => {
|
|
55
|
+
console.log(`${type} 文件渲染完成`)
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 方式二:按需引入
|
|
61
|
+
|
|
62
|
+
```vue
|
|
63
|
+
<template>
|
|
64
|
+
<OfficePreview
|
|
65
|
+
:file-url="fileUrl"
|
|
66
|
+
:file-type="fileType"
|
|
67
|
+
height="600px"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { OfficePreview } from '@jrchan/office-preview'
|
|
73
|
+
|
|
74
|
+
// ✅ 文件 URL 由使用方提供
|
|
75
|
+
const fileUrl = 'https://cdn.example.com/report.xlsx'
|
|
76
|
+
const fileType = 'xlsx'
|
|
77
|
+
</script>
|
|
13
78
|
```
|
|
14
79
|
|
|
15
|
-
|
|
80
|
+
## Props 参数
|
|
81
|
+
|
|
82
|
+
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|
|
83
|
+
|--------|------|------|--------|------|
|
|
84
|
+
| file-url | `string` | ✅ 是 | `''` | 文件 URL 地址(支持 http/https/blob URL) |
|
|
85
|
+
| file-type | `string` | ✅ 是 | `''` | 文件类型(doc/docx/xls/xlsx/ppt/pptx/pdf) |
|
|
86
|
+
| height | `string` | ❌ 否 | `'100%'` | 预览区域高度 |
|
|
87
|
+
|
|
88
|
+
## Events 事件
|
|
89
|
+
|
|
90
|
+
| 事件名 | 回调参数 | 说明 |
|
|
91
|
+
|--------|----------|------|
|
|
92
|
+
| rendered | `(type: string)` | 文件渲染完成时触发 |
|
|
93
|
+
|
|
94
|
+
## 完整示例
|
|
95
|
+
|
|
96
|
+
### 示例 1:从服务器加载文件
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<template>
|
|
100
|
+
<OfficePreview
|
|
101
|
+
:file-url="documentUrl"
|
|
102
|
+
:file-type="documentType"
|
|
103
|
+
/>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script setup lang="ts">
|
|
107
|
+
import { ref } from 'vue'
|
|
108
|
+
|
|
109
|
+
const documentUrl = ref('https://example.com/contracts/2024.docx')
|
|
110
|
+
const documentType = ref('docx')
|
|
111
|
+
</script>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 示例 2:上传文件后预览
|
|
115
|
+
|
|
116
|
+
```vue
|
|
117
|
+
<template>
|
|
118
|
+
<div>
|
|
119
|
+
<input type="file" @change="handleFileChange" accept=".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx" />
|
|
120
|
+
<OfficePreview
|
|
121
|
+
v-if="fileUrl"
|
|
122
|
+
:file-url="fileUrl"
|
|
123
|
+
:file-type="fileType"
|
|
124
|
+
/>
|
|
125
|
+
</div>
|
|
126
|
+
</template>
|
|
127
|
+
|
|
128
|
+
<script setup lang="ts">
|
|
129
|
+
import { ref } from 'vue'
|
|
130
|
+
import { OfficePreview } from '@jrchan/office-preview'
|
|
131
|
+
|
|
132
|
+
const fileUrl = ref<string>('')
|
|
133
|
+
const fileType = ref<string>('')
|
|
134
|
+
|
|
135
|
+
const handleFileChange = (e: Event) => {
|
|
136
|
+
const target = e.target as HTMLInputElement
|
|
137
|
+
const file = target.files?.[0]
|
|
138
|
+
if (file) {
|
|
139
|
+
// 创建 Blob URL
|
|
140
|
+
fileUrl.value = URL.createObjectURL(file)
|
|
141
|
+
fileType.value = file.name // 组件会根据文件名自动识别类型
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
</script>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 示例 3:文件列表切换预览
|
|
148
|
+
|
|
149
|
+
```vue
|
|
150
|
+
<template>
|
|
151
|
+
<div class="document-viewer">
|
|
152
|
+
<ul>
|
|
153
|
+
<li v-for="file in fileList" :key="file.id" @click="selectFile(file)">
|
|
154
|
+
{{ file.name }}
|
|
155
|
+
</li>
|
|
156
|
+
</ul>
|
|
157
|
+
|
|
158
|
+
<OfficePreview
|
|
159
|
+
v-if="selectedFile"
|
|
160
|
+
:file-url="selectedFile.url"
|
|
161
|
+
:file-type="selectedFile.type"
|
|
162
|
+
height="600px"
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
</template>
|
|
166
|
+
|
|
167
|
+
<script setup lang="ts">
|
|
168
|
+
import { ref } from 'vue'
|
|
169
|
+
import { OfficePreview } from '@jrchan/office-preview'
|
|
16
170
|
|
|
17
|
-
|
|
171
|
+
interface FileItem {
|
|
172
|
+
id: number
|
|
173
|
+
name: string
|
|
174
|
+
url: string
|
|
175
|
+
type: string
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const fileList = ref<FileItem[]>([
|
|
179
|
+
{ id: 1, name: '合同.docx', url: 'https://cdn.example.com/contract.docx', type: 'docx' },
|
|
180
|
+
{ id: 2, name: '报表.xlsx', url: 'https://cdn.example.com/report.xlsx', type: 'xlsx' },
|
|
181
|
+
{ id: 3, name: '演示.pptx', url: 'https://cdn.example.com/demo.pptx', type: 'pptx' },
|
|
182
|
+
])
|
|
183
|
+
|
|
184
|
+
const selectedFile = ref<FileItem | null>(null)
|
|
185
|
+
|
|
186
|
+
const selectFile = (file: FileItem) => {
|
|
187
|
+
selectedFile.value = file
|
|
188
|
+
}
|
|
189
|
+
</script>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## ⚠️ CSP 配置说明
|
|
193
|
+
|
|
194
|
+
本组件使用 Web Worker 处理文档解析,如遇到 CSP 报错,请在使用方项目中添加以下配置:
|
|
195
|
+
|
|
196
|
+
### Nginx 配置
|
|
197
|
+
```nginx
|
|
198
|
+
add_header Content-Security-Policy "worker-src 'self' blob: data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:;";
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### HTML Meta 标签
|
|
202
|
+
```html
|
|
203
|
+
<meta http-equiv="Content-Security-Policy"
|
|
204
|
+
content="worker-src 'self' blob: data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:;">
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Vite 开发环境
|
|
208
|
+
```typescript
|
|
209
|
+
// vite.config.ts
|
|
210
|
+
export default defineConfig({
|
|
211
|
+
server: {
|
|
212
|
+
headers: {
|
|
213
|
+
'Content-Security-Policy': "worker-src 'self' blob: data:;",
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
})
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 支持的文档格式
|
|
220
|
+
|
|
221
|
+
| 格式类型 | 扩展名 | 使用的组件 |
|
|
222
|
+
|----------|--------|-----------|
|
|
223
|
+
| PDF | `.pdf` | @vue-office/pdf |
|
|
224
|
+
| Word | `.doc`, `.docx` | @vue-office/docx |
|
|
225
|
+
| Excel | `.xls`, `.xlsx`, `.csv` | @vue-office/excel |
|
|
226
|
+
| PowerPoint | `.ppt`, `.pptx` | @vue-office/pptx |
|
|
227
|
+
|
|
228
|
+
## 常见问题
|
|
229
|
+
|
|
230
|
+
### Q1: 为什么组件会加载 `/file/234.docx`?
|
|
231
|
+
|
|
232
|
+
**A:** 这是误解。组件**不会**加载任何测试文件。请检查:
|
|
233
|
+
|
|
234
|
+
1. ✅ 是否正确传入了 `file-url` 参数
|
|
235
|
+
2. ✅ 参数值是否为你自己的文件 URL
|
|
236
|
+
3. ✅ 是否误将本地测试代码复制到了使用方项目
|
|
237
|
+
|
|
238
|
+
组件的 `App.vue` 仅用于本地开发调试,**不会被打包到 npm 包中**。
|
|
239
|
+
|
|
240
|
+
### Q2: 不传参数会怎样?
|
|
241
|
+
|
|
242
|
+
**A:** 如果不传入 `file-url` 和 `file-type`,组件将显示"请选择文件进行预览"提示,不会加载任何文件。
|
|
243
|
+
|
|
244
|
+
### Q3: 如何查看构建产物确认没有 App.vue?
|
|
245
|
+
|
|
246
|
+
**A:** 执行以下命令:
|
|
247
|
+
```bash
|
|
248
|
+
npm run build
|
|
249
|
+
grep -r "234.docx" dist/ # 应该无结果
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 开发指南
|
|
253
|
+
|
|
254
|
+
### 本地开发调试
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# 安装依赖
|
|
258
|
+
pnpm install
|
|
259
|
+
|
|
260
|
+
# 启动开发服务器(访问 localhost:5173 查看测试页面)
|
|
261
|
+
pnpm dev
|
|
262
|
+
|
|
263
|
+
# 构建生产包
|
|
18
264
|
pnpm build
|
|
265
|
+
|
|
266
|
+
# 发布到 npm
|
|
267
|
+
npm publish --access public
|
|
19
268
|
```
|
|
20
269
|
|
|
21
|
-
###
|
|
270
|
+
### 项目结构
|
|
22
271
|
|
|
23
|
-
```sh
|
|
24
|
-
pnpm lint
|
|
25
272
|
```
|
|
273
|
+
@jrchan/office-preview/
|
|
274
|
+
├── src/
|
|
275
|
+
│ ├── components/
|
|
276
|
+
│ │ └── office-preview.vue # ✅ 核心组件(会被打包)
|
|
277
|
+
│ ├── index.ts # ✅ 导出入口(会被打包)
|
|
278
|
+
│ ├── App.vue # ❌ 仅本地测试(不会打包)
|
|
279
|
+
│ └── main.ts # ❌ 仅本地测试(不会打包)
|
|
280
|
+
├── dist/ # 构建输出(发布到 npm)
|
|
281
|
+
├── package.json
|
|
282
|
+
└── vite.config.ts
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## License
|
|
286
|
+
|
|
287
|
+
MIT
|
package/dist/office-preview.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.file-preview-container[data-v-
|
|
1
|
+
.file-preview-container[data-v-a3fccd66],.preview-area[data-v-a3fccd66]{height:100%}
|
|
@@ -41,7 +41,7 @@ const g = { class: "file-preview-container" }, w = { class: "preview-area" }, y
|
|
|
41
41
|
for (const [c, i] of n)
|
|
42
42
|
e[c] = i;
|
|
43
43
|
return e;
|
|
44
|
-
}, C = /* @__PURE__ */ k(h, [["__scopeId", "data-v-
|
|
44
|
+
}, C = /* @__PURE__ */ k(h, [["__scopeId", "data-v-a3fccd66"]]), E = [C], O = (l) => {
|
|
45
45
|
E.forEach((n) => {
|
|
46
46
|
l.component(n.name, n);
|
|
47
47
|
});
|
|
@@ -50,4 +50,3 @@ export {
|
|
|
50
50
|
C as OfficePreview,
|
|
51
51
|
T as default
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=office-preview.es.js.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o
|
|
2
|
-
//# sourceMappingURL=office-preview.umd.js.map
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.OfficePreview={},o.Vue))})(this,(function(o,e){"use strict";const f={class:"file-preview-container"},a={class:"preview-area"},p={key:0,class:"loading-mask"},r=((l,s)=>{const t=l.__vccOpts||l;for(const[d,c]of s)t[d]=c;return t})(e.defineComponent({name:"OfficePreview",__name:"office-preview",props:{fileUrl:{default:""},fileType:{default:""},height:{default:"100%"}},emits:["rendered"],setup(l,{emit:s}){let t=e.ref("pdf"),d=e.ref(!1);const c=l,_=i=>{console.log("fileName",i);const n=i.toLowerCase().split(".").pop();["pdf"].includes(n)?t.value="pdf":["doc","docx"].includes(n)?t.value="doc":["xls","xlsx","csv"].includes(n)?t.value="xls":["ppt","pptx"].includes(n)?(t.value="ppt",console.log("pptxPrviewer",i)):t.value="other"};return e.watch([()=>c.fileType,()=>c.fileUrl],i=>{t.value=i[0],_(i[1])},{immediate:!0}),e.onMounted(async()=>{}),(i,n)=>(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",a,[n[0]||(n[0]=e.createElementVNode("div",null,"在线预览",-1)),e.createElementVNode("div",null,e.toDisplayString(l.fileUrl),1)]),e.unref(d)?(e.openBlock(),e.createElementBlock("div",p,[...n[1]||(n[1]=[e.createElementVNode("div",{class:"loading-content"},[e.createElementVNode("div",{class:"spinner"}),e.createElementVNode("p",null,"正在加载文件...")],-1)])])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-a3fccd66"]]),m=[r],u={install:l=>{m.forEach(s=>{l.component(s.name,s)})}};o.OfficePreview=r,o.default=u,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jrchan/office-preview",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "在线预览文档,支持docx、pptx、excel、pdf等格式,基于Vue3和@vue-office系列组件构建,适用于大屏展示和文档预览场景。",
|
|
6
6
|
"keywords": [
|
|
@@ -11,20 +11,18 @@
|
|
|
11
11
|
"pdf"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
],
|
|
17
|
-
"main": "dist/example.umd.js",
|
|
18
|
-
"module": "dist/example.es.js",
|
|
14
|
+
"main": "dist/office-preview.umd.js",
|
|
15
|
+
"module": "dist/office-preview.es.js",
|
|
19
16
|
"types": "dist/index.d.ts",
|
|
17
|
+
"files": ["dist"],
|
|
20
18
|
"publishConfig": {
|
|
21
19
|
"access": "public"
|
|
22
20
|
},
|
|
23
21
|
"exports": {
|
|
24
22
|
".": {
|
|
25
23
|
"types": "./dist/index.d.ts",
|
|
26
|
-
|
|
27
|
-
"require": "./dist/
|
|
24
|
+
"import": "./dist/office-preview.es.js",
|
|
25
|
+
"require": "./dist/office-preview.umd.js"
|
|
28
26
|
}
|
|
29
27
|
},
|
|
30
28
|
"scripts": {
|
package/dist/App.vue.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
2
|
-
export default _default;
|
package/dist/example.es.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { defineComponent as f, ref as a, watch as u, onMounted as v, openBlock as d, createElementBlock as r, createElementVNode as s, toDisplayString as m, unref as _, createCommentVNode as x } from "vue";
|
|
2
|
-
const g = { class: "file-preview-container" }, w = { class: "preview-area" }, y = {
|
|
3
|
-
key: 0,
|
|
4
|
-
class: "loading-mask"
|
|
5
|
-
}, h = /* @__PURE__ */ f({
|
|
6
|
-
name: "OfficePreview",
|
|
7
|
-
__name: "office-preview",
|
|
8
|
-
props: {
|
|
9
|
-
fileUrl: { default: "" },
|
|
10
|
-
fileType: { default: "" },
|
|
11
|
-
height: { default: "100%" }
|
|
12
|
-
},
|
|
13
|
-
emits: ["rendered"],
|
|
14
|
-
setup(l, { emit: n }) {
|
|
15
|
-
let e = a("pdf"), c = a(!1);
|
|
16
|
-
const i = l, p = (o) => {
|
|
17
|
-
console.log("fileName", o);
|
|
18
|
-
const t = o.toLowerCase().split(".").pop();
|
|
19
|
-
["pdf"].includes(t) ? e.value = "pdf" : ["doc", "docx"].includes(t) ? e.value = "doc" : ["xls", "xlsx", "csv"].includes(t) ? e.value = "xls" : ["ppt", "pptx"].includes(t) ? (e.value = "ppt", console.log("pptxPrviewer", o)) : e.value = "other";
|
|
20
|
-
};
|
|
21
|
-
return u([() => i.fileType, () => i.fileUrl], (o) => {
|
|
22
|
-
e.value = o[0], p(o[1]);
|
|
23
|
-
}, {
|
|
24
|
-
immediate: !0
|
|
25
|
-
}), v(async () => {
|
|
26
|
-
}), (o, t) => (d(), r("div", g, [
|
|
27
|
-
s("div", w, [
|
|
28
|
-
t[0] || (t[0] = s("div", null, "在线预览", -1)),
|
|
29
|
-
s("div", null, m(l.fileUrl), 1)
|
|
30
|
-
]),
|
|
31
|
-
_(c) ? (d(), r("div", y, [...t[1] || (t[1] = [
|
|
32
|
-
s("div", { class: "loading-content" }, [
|
|
33
|
-
s("div", { class: "spinner" }),
|
|
34
|
-
s("p", null, "正在加载文件...")
|
|
35
|
-
], -1)
|
|
36
|
-
])])) : x("", !0)
|
|
37
|
-
]));
|
|
38
|
-
}
|
|
39
|
-
}), k = (l, n) => {
|
|
40
|
-
const e = l.__vccOpts || l;
|
|
41
|
-
for (const [c, i] of n)
|
|
42
|
-
e[c] = i;
|
|
43
|
-
return e;
|
|
44
|
-
}, C = /* @__PURE__ */ k(h, [["__scopeId", "data-v-52dc7711"]]), E = [C], O = (l) => {
|
|
45
|
-
E.forEach((n) => {
|
|
46
|
-
l.component(n.name, n);
|
|
47
|
-
});
|
|
48
|
-
}, T = { install: O };
|
|
49
|
-
export {
|
|
50
|
-
C as OfficePreview,
|
|
51
|
-
T as default
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=example.es.js.map
|
package/dist/example.es.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.es.js","sources":["../src/components/office-preview.vue","../src/index.ts"],"sourcesContent":["<!--\n * @Title: office-preview\n * @Author: diaojw\n * @Package: components,.*\n * @Date: 2026/03/19 14:05\n * @description: 在线预览文件组件\n -->\n<template>\n <div class=\"file-preview-container\">\n <!-- 预览区域 -->\n <div class=\"preview-area\">\n <div>在线预览</div>\n <div>{{ fileUrl }}</div>\n <!-- PDF 预览 -->\n <!-- <VuePdfEmbed v-if=\"activeType === 'pdf' && fileUrl\" annotation-layer text-layer :source=\"fileUrl\" style=\"height: 500px;\"/> -->\n <!-- <div :src=\"fileUrl\" style=\"height: 100%;width: 100%;\" id=\"pptx-wrapper\"></div> -->\n </div>\n\n <!-- 加载状态 -->\n <div v-if=\"loading\" class=\"loading-mask\">\n <div class=\"loading-content\">\n <div class=\"spinner\"></div>\n <p>正在加载文件...</p>\n </div>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\n// 按需引入\nimport { watch, ref, onMounted } from 'vue'\nimport '@vue-office/docx/lib/v3/index.css';\nimport '@vue-office/excel/lib/v3/index.css';\n// import VuePdfEmbed from 'vue-pdf-embed'\n\n// Optional styles\nimport 'vue-pdf-embed/dist/styles/annotationLayer.css'\nimport 'vue-pdf-embed/dist/styles/textLayer.css'\n\n\nlet activeType = ref<string>('pdf') // 当前预览的文件类型\nlet loading = ref(false)\n\nconst props = withDefaults(defineProps<{\n fileUrl: string,\n fileType: string,\n height? : string,\n}>(), {\n fileUrl: '',\n fileType: '',\n height: '100%'\n})\nconst emit = defineEmits(['rendered'])\n\nconst detectFileType = (fileName: string) => {\n console.log('fileName', fileName)\n const ext: any = fileName.toLowerCase().split('.').pop()\n if (['pdf'].includes(ext)) {\n activeType.value = 'pdf'\n } else if (['doc', 'docx'].includes(ext)) {\n activeType.value = 'doc'\n } else if (['xls', 'xlsx', 'csv'].includes(ext)) {\n activeType.value = 'xls'\n } else if (['ppt', 'pptx'].includes(ext)) {\n activeType.value = 'ppt'\n console.log('pptxPrviewer', fileName)\n } else {\n activeType.value = 'other'\n }\n}\nwatch([() => props.fileType, () => props.fileUrl], (newType) => {\n activeType.value = newType[0];\n detectFileType(newType[1])\n // activeType.value = newType[1];\n}, {\n immediate: true\n})\ndefineOptions({\n name: 'OfficePreview', // 一定要有 name\n})\n\nonMounted(async () => {\n // const response = await fetch('/file/123.pdf'); // 确保public目录有该文件\n // const blob = await response.blob();\n // docxUrl.value = URL.createObjectURL(blob);\n})\n\n// 渲染完成回调\n// const handleRendered = () => {\n// console.log('文件渲染完成')\n// emit('rendered', activeType)\n// }\n\n\n</script>\n\n<style scoped>\n.file-preview-container {\n height: 100%;\n}\n\n.preview-area {\n height: 100%;\n}\n</style>\n","/**\n * @Title: index\n * @Author diaojw\n * @Package\n * @Date 2026/3/19 21:31\n * @description: 这里导出组件\n */\n\nimport type { App } from 'vue'\nimport OfficePreview from './components/office-preview.vue'\n// import ExampleDom1 from '../src/components/ExampleDom1.vue'; // 如果有多个组件一起打包\n\nconst components = [OfficePreview]\n// const components = [OfficePreview, ExampleDom1]; // 如果有多个组件一起打包\n\nexport { OfficePreview } // 按需引入\n// export { ExampleDom, ExampleDom1 }; // 按需引入,如果有多个组件一起打包就可以一起写\n\nconst install = (app: App) => {\n components.forEach((component) => {\n app.component(component.name as string, component)\n })\n}\nexport default { install }\n"],"names":["activeType","ref","loading","props","__props","detectFileType","fileName","ext","watch","newType","onMounted","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_cache","_unref","_hoisted_3","components","OfficePreview","install","app","component","index"],"mappings":";;;;;;;;;;;;;;AAuCA,QAAIA,IAAaC,EAAY,KAAK,GAC9BC,IAAUD,EAAI,EAAK;AAEvB,UAAME,IAAQC,GAWRC,IAAiB,CAACC,MAAqB;AAC3C,cAAQ,IAAI,YAAYA,CAAQ;AAChC,YAAMC,IAAWD,EAAS,YAAA,EAAc,MAAM,GAAG,EAAE,IAAA;AACnD,MAAI,CAAC,KAAK,EAAE,SAASC,CAAG,IACtBP,EAAW,QAAQ,QACV,CAAC,OAAO,MAAM,EAAE,SAASO,CAAG,IACrCP,EAAW,QAAQ,QACV,CAAC,OAAO,QAAQ,KAAK,EAAE,SAASO,CAAG,IAC5CP,EAAW,QAAQ,QACV,CAAC,OAAO,MAAM,EAAE,SAASO,CAAG,KACrCP,EAAW,QAAQ,OACnB,QAAQ,IAAI,gBAAgBM,CAAQ,KAEpCN,EAAW,QAAQ;AAAA,IAEvB;AACA,WAAAQ,EAAM,CAAC,MAAML,EAAM,UAAU,MAAMA,EAAM,OAAO,GAAG,CAACM,MAAY;AAC9D,MAAAT,EAAW,QAAQS,EAAQ,CAAC,GAC5BJ,EAAeI,EAAQ,CAAC,CAAC;AAAA,IAE3B,GAAG;AAAA,MACD,WAAW;AAAA,IAAA,CACZ,GAKDC,EAAU,YAAY;AAAA,IAItB,CAAC,cA5ECC,EAAA,GAAAC,EAiBM,OAjBNC,GAiBM;AAAA,MAfJC,EAMM,OANNC,GAMM;AAAA,QALJC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAAF,EAAe,aAAV,QAAI,EAAA;AAAA,QACTA,EAAwB,eAAhBV,EAAA,OAAO,GAAA,CAAA;AAAA,MAAA;MAONa,EAAAf,CAAA,KAAXS,EAAA,GAAAC,EAKM,OALNM,GAKM,CAAA,GAAAF,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,QAJJF,EAGM,OAAA,EAHD,OAAM,qBAAiB;AAAA,UAC1BA,EAA2B,OAAA,EAAtB,OAAM,WAAS;AAAA,UACpBA,EAAgB,WAAb,WAAS;AAAA,QAAA;;;;;;;;;iECVdK,IAAa,CAACC,CAAa,GAM3BC,IAAU,CAACC,MAAa;AAC5B,EAAAH,EAAW,QAAQ,CAACI,MAAc;AAChC,IAAAD,EAAI,UAAUC,EAAU,MAAgBA,CAAS;AAAA,EACnD,CAAC;AACH,GACAC,IAAe,EAAE,SAAAH,EAAA;"}
|
package/dist/example.umd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.example={},l.Vue))})(this,(function(l,e){"use strict";const a={class:"file-preview-container"},f={class:"preview-area"},p={key:0,class:"loading-mask"},r=((o,s)=>{const t=o.__vccOpts||o;for(const[d,c]of s)t[d]=c;return t})(e.defineComponent({name:"OfficePreview",__name:"office-preview",props:{fileUrl:{default:""},fileType:{default:""},height:{default:"100%"}},emits:["rendered"],setup(o,{emit:s}){let t=e.ref("pdf"),d=e.ref(!1);const c=o,_=i=>{console.log("fileName",i);const n=i.toLowerCase().split(".").pop();["pdf"].includes(n)?t.value="pdf":["doc","docx"].includes(n)?t.value="doc":["xls","xlsx","csv"].includes(n)?t.value="xls":["ppt","pptx"].includes(n)?(t.value="ppt",console.log("pptxPrviewer",i)):t.value="other"};return e.watch([()=>c.fileType,()=>c.fileUrl],i=>{t.value=i[0],_(i[1])},{immediate:!0}),e.onMounted(async()=>{}),(i,n)=>(e.openBlock(),e.createElementBlock("div",a,[e.createElementVNode("div",f,[n[0]||(n[0]=e.createElementVNode("div",null,"在线预览",-1)),e.createElementVNode("div",null,e.toDisplayString(o.fileUrl),1)]),e.unref(d)?(e.openBlock(),e.createElementBlock("div",p,[...n[1]||(n[1]=[e.createElementVNode("div",{class:"loading-content"},[e.createElementVNode("div",{class:"spinner"}),e.createElementVNode("p",null,"正在加载文件...")],-1)])])):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-52dc7711"]]),m=[r],u={install:o=>{m.forEach(s=>{o.component(s.name,s)})}};l.OfficePreview=r,l.default=u,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
2
|
-
//# sourceMappingURL=example.umd.js.map
|
package/dist/example.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.umd.js","sources":["../src/components/office-preview.vue","../src/index.ts"],"sourcesContent":["<!--\n * @Title: office-preview\n * @Author: diaojw\n * @Package: components,.*\n * @Date: 2026/03/19 14:05\n * @description: 在线预览文件组件\n -->\n<template>\n <div class=\"file-preview-container\">\n <!-- 预览区域 -->\n <div class=\"preview-area\">\n <div>在线预览</div>\n <div>{{ fileUrl }}</div>\n <!-- PDF 预览 -->\n <!-- <VuePdfEmbed v-if=\"activeType === 'pdf' && fileUrl\" annotation-layer text-layer :source=\"fileUrl\" style=\"height: 500px;\"/> -->\n <!-- <div :src=\"fileUrl\" style=\"height: 100%;width: 100%;\" id=\"pptx-wrapper\"></div> -->\n </div>\n\n <!-- 加载状态 -->\n <div v-if=\"loading\" class=\"loading-mask\">\n <div class=\"loading-content\">\n <div class=\"spinner\"></div>\n <p>正在加载文件...</p>\n </div>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\n// 按需引入\nimport { watch, ref, onMounted } from 'vue'\nimport '@vue-office/docx/lib/v3/index.css';\nimport '@vue-office/excel/lib/v3/index.css';\n// import VuePdfEmbed from 'vue-pdf-embed'\n\n// Optional styles\nimport 'vue-pdf-embed/dist/styles/annotationLayer.css'\nimport 'vue-pdf-embed/dist/styles/textLayer.css'\n\n\nlet activeType = ref<string>('pdf') // 当前预览的文件类型\nlet loading = ref(false)\n\nconst props = withDefaults(defineProps<{\n fileUrl: string,\n fileType: string,\n height? : string,\n}>(), {\n fileUrl: '',\n fileType: '',\n height: '100%'\n})\nconst emit = defineEmits(['rendered'])\n\nconst detectFileType = (fileName: string) => {\n console.log('fileName', fileName)\n const ext: any = fileName.toLowerCase().split('.').pop()\n if (['pdf'].includes(ext)) {\n activeType.value = 'pdf'\n } else if (['doc', 'docx'].includes(ext)) {\n activeType.value = 'doc'\n } else if (['xls', 'xlsx', 'csv'].includes(ext)) {\n activeType.value = 'xls'\n } else if (['ppt', 'pptx'].includes(ext)) {\n activeType.value = 'ppt'\n console.log('pptxPrviewer', fileName)\n } else {\n activeType.value = 'other'\n }\n}\nwatch([() => props.fileType, () => props.fileUrl], (newType) => {\n activeType.value = newType[0];\n detectFileType(newType[1])\n // activeType.value = newType[1];\n}, {\n immediate: true\n})\ndefineOptions({\n name: 'OfficePreview', // 一定要有 name\n})\n\nonMounted(async () => {\n // const response = await fetch('/file/123.pdf'); // 确保public目录有该文件\n // const blob = await response.blob();\n // docxUrl.value = URL.createObjectURL(blob);\n})\n\n// 渲染完成回调\n// const handleRendered = () => {\n// console.log('文件渲染完成')\n// emit('rendered', activeType)\n// }\n\n\n</script>\n\n<style scoped>\n.file-preview-container {\n height: 100%;\n}\n\n.preview-area {\n height: 100%;\n}\n</style>\n","/**\n * @Title: index\n * @Author diaojw\n * @Package\n * @Date 2026/3/19 21:31\n * @description: 这里导出组件\n */\n\nimport type { App } from 'vue'\nimport OfficePreview from './components/office-preview.vue'\n// import ExampleDom1 from '../src/components/ExampleDom1.vue'; // 如果有多个组件一起打包\n\nconst components = [OfficePreview]\n// const components = [OfficePreview, ExampleDom1]; // 如果有多个组件一起打包\n\nexport { OfficePreview } // 按需引入\n// export { ExampleDom, ExampleDom1 }; // 按需引入,如果有多个组件一起打包就可以一起写\n\nconst install = (app: App) => {\n components.forEach((component) => {\n app.component(component.name as string, component)\n })\n}\nexport default { install }\n"],"names":["activeType","ref","loading","props","__props","detectFileType","fileName","ext","watch","newType","onMounted","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_cache","_unref","_hoisted_3","components","OfficePreview","index","app","component"],"mappings":"qlBAuCA,IAAIA,EAAaC,EAAAA,IAAY,KAAK,EAC9BC,EAAUD,EAAAA,IAAI,EAAK,EAEvB,MAAME,EAAQC,EAWRC,EAAkBC,GAAqB,CAC3C,QAAQ,IAAI,WAAYA,CAAQ,EAChC,MAAMC,EAAWD,EAAS,YAAA,EAAc,MAAM,GAAG,EAAE,IAAA,EAC/C,CAAC,KAAK,EAAE,SAASC,CAAG,EACtBP,EAAW,MAAQ,MACV,CAAC,MAAO,MAAM,EAAE,SAASO,CAAG,EACrCP,EAAW,MAAQ,MACV,CAAC,MAAO,OAAQ,KAAK,EAAE,SAASO,CAAG,EAC5CP,EAAW,MAAQ,MACV,CAAC,MAAO,MAAM,EAAE,SAASO,CAAG,GACrCP,EAAW,MAAQ,MACnB,QAAQ,IAAI,eAAgBM,CAAQ,GAEpCN,EAAW,MAAQ,OAEvB,EACAQ,OAAAA,QAAM,CAAC,IAAML,EAAM,SAAU,IAAMA,EAAM,OAAO,EAAIM,GAAY,CAC9DT,EAAW,MAAQS,EAAQ,CAAC,EAC5BJ,EAAeI,EAAQ,CAAC,CAAC,CAE3B,EAAG,CACD,UAAW,EAAA,CACZ,EAKDC,EAAAA,UAAU,SAAY,CAItB,CAAC,UA5ECC,YAAA,EAAAC,qBAiBM,MAjBNC,EAiBM,CAfJC,EAAAA,mBAMM,MANNC,EAMM,CALJC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAF,qBAAe,WAAV,OAAI,EAAA,GACTA,EAAAA,mBAAwB,6BAAhBV,EAAA,OAAO,EAAA,CAAA,CAAA,GAONa,EAAAA,MAAAf,CAAA,GAAXS,YAAA,EAAAC,EAAAA,mBAKM,MALNM,EAKM,CAAA,GAAAF,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAA,CAJJF,EAAAA,mBAGM,MAAA,CAHD,MAAM,mBAAiB,CAC1BA,EAAAA,mBAA2B,MAAA,CAAtB,MAAM,UAAS,EACpBA,qBAAgB,SAAb,WAAS,CAAA,gFCVdK,EAAa,CAACC,CAAa,EAWjCC,EAAe,CAAE,QALAC,GAAa,CAC5BH,EAAW,QAASI,GAAc,CAChCD,EAAI,UAAUC,EAAU,KAAgBA,CAAS,CACnD,CAAC,CACH,CACiB"}
|
package/dist/main.d.ts
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.vue-office-docx{height:100%;overflow-y:auto}.vue-office-docx .docx-wrapper>section.docx{margin-bottom:5px}@media screen and (max-width:800px){.vue-office-docx .docx-wrapper{padding:10px}.vue-office-docx .docx-wrapper>section.docx{padding:10px!important;width:100%!important}}body{margin:0}.x-spreadsheet{font-size:13px;line-height:normal;-webkit-user-select:none;user-select:none;-moz-user-select:none;font-family:Lato,Source Sans Pro,Roboto,Helvetica,Arial,sans-serif;box-sizing:content-box;background:#fff;-webkit-font-smoothing:antialiased}.x-spreadsheet textarea{font:400 13px Arial,Lato,Source Sans Pro,Roboto,Helvetica,sans-serif}.x-spreadsheet-sheet{position:relative;overflow:hidden}.x-spreadsheet-table{vertical-align:bottom}.x-spreadsheet-tooltip{font-family:inherit;position:absolute;padding:5px 10px;color:#fff;border-radius:1px;background:#000;font-size:12px;z-index:201}.x-spreadsheet-tooltip:before{pointer-events:none;position:absolute;left:calc(50% - 4px);top:-4px;content:"";width:8px;height:8px;background:inherit;-webkit-transform:rotate(45deg);transform:rotate(45deg);z-index:1;box-shadow:1px 1px 3px -1px #0000004d}.x-spreadsheet-color-palette{padding:5px}.x-spreadsheet-color-palette table{margin:0;padding:0;border-collapse:separate;border-spacing:2;background:#fff}.x-spreadsheet-color-palette table td{margin:0;cursor:pointer;border:1px solid transparent}.x-spreadsheet-color-palette table td:hover{border-color:#ddd}.x-spreadsheet-color-palette table td .x-spreadsheet-color-palette-cell{width:16px;height:16px}.x-spreadsheet-border-palette{padding:6px}.x-spreadsheet-border-palette table{margin:0;padding:0;border-collapse:separate;border-spacing:0;background:#fff;table-layout:fixed}.x-spreadsheet-border-palette table td{margin:0}.x-spreadsheet-border-palette .x-spreadsheet-border-palette-left{border-right:1px solid #eee;padding-right:6px}.x-spreadsheet-border-palette .x-spreadsheet-border-palette-left .x-spreadsheet-border-palette-cell{width:30px;height:30px;cursor:pointer;text-align:center}.x-spreadsheet-border-palette .x-spreadsheet-border-palette-left .x-spreadsheet-border-palette-cell:hover{background-color:#eee}.x-spreadsheet-border-palette .x-spreadsheet-border-palette-right{padding-left:6px}.x-spreadsheet-border-palette .x-spreadsheet-border-palette-right .x-spreadsheet-line-type{position:relative;left:0;top:-3px}.x-spreadsheet-dropdown{position:relative}.x-spreadsheet-dropdown .x-spreadsheet-dropdown-content{position:absolute;z-index:200;background:#fff;box-shadow:1px 2px 5px 2px #33333326}.x-spreadsheet-dropdown.bottom-left .x-spreadsheet-dropdown-content{top:calc(100% + 5px);left:0}.x-spreadsheet-dropdown.bottom-right .x-spreadsheet-dropdown-content{top:calc(100% + 5px);right:0}.x-spreadsheet-dropdown.top-left .x-spreadsheet-dropdown-content{bottom:calc(100% + 5px);left:0}.x-spreadsheet-dropdown.top-right .x-spreadsheet-dropdown-content{bottom:calc(100% + 5px);right:0}.x-spreadsheet-dropdown .x-spreadsheet-dropdown-title{padding:0 5px;display:inline-block}.x-spreadsheet-resizer{position:absolute;z-index:11}.x-spreadsheet-resizer .x-spreadsheet-resizer-hover{background-color:#4b89ff40}.x-spreadsheet-resizer .x-spreadsheet-resizer-line{position:absolute}.x-spreadsheet-resizer.horizontal{cursor:row-resize}.x-spreadsheet-resizer.horizontal .x-spreadsheet-resizer-line{border-bottom:2px dashed #4b89ff;left:0;bottom:0}.x-spreadsheet-resizer.vertical{cursor:col-resize}.x-spreadsheet-resizer.vertical .x-spreadsheet-resizer-line{border-right:2px dashed #4b89ff;top:0;right:0}.x-spreadsheet-scrollbar{position:absolute;bottom:0;right:0;background-color:#f4f5f8;opacity:.9;z-index:12}.x-spreadsheet-scrollbar.horizontal{right:15px;overflow-x:scroll;overflow-y:hidden}.x-spreadsheet-scrollbar.horizontal>div{height:1px;background:#ddd}.x-spreadsheet-scrollbar.vertical{bottom:15px;overflow-x:hidden;overflow-y:scroll}.x-spreadsheet-scrollbar.vertical>div{width:1px;background:#ddd}.x-spreadsheet-overlayer{position:absolute;left:0;top:0;z-index:10}.x-spreadsheet-overlayer .x-spreadsheet-overlayer-content{position:absolute;overflow:hidden;pointer-events:none;width:100%;height:100%}.x-spreadsheet-editor,.x-spreadsheet-selector{box-sizing:content-box;position:absolute;overflow:hidden;pointer-events:none;top:0;left:0;width:100%;height:100%}.x-spreadsheet-selector .hide-input{position:absolute;z-index:0}.x-spreadsheet-selector .hide-input input{padding:0;width:0;border:none!important}.x-spreadsheet-selector .x-spreadsheet-selector-area{position:absolute;border:2px solid #4b89ff;background:#4b89ff1a;z-index:5}.x-spreadsheet-selector .x-spreadsheet-selector-clipboard,.x-spreadsheet-selector .x-spreadsheet-selector-autofill{position:absolute;background:transparent;z-index:100}.x-spreadsheet-selector .x-spreadsheet-selector-clipboard{border:2px dashed #4b89ff}.x-spreadsheet-selector .x-spreadsheet-selector-autofill{border:1px dashed rgba(0,0,0,.45)}.x-spreadsheet-selector .x-spreadsheet-selector-corner{pointer-events:auto;position:absolute;cursor:crosshair;font-size:0;height:5px;width:5px;right:-5px;bottom:-5px;border:2px solid #ffffff;background:#4b89ff}.x-spreadsheet-editor{z-index:20}.x-spreadsheet-editor .x-spreadsheet-editor-area{position:absolute;text-align:left;border:2px solid #4b89ff;line-height:0;z-index:100;pointer-events:auto}.x-spreadsheet-editor .x-spreadsheet-editor-area textarea{box-sizing:content-box;border:none;padding:0 3px;outline:none;resize:none;text-align:start;overflow-y:hidden;font:400 13px Arial,Lato,Source Sans Pro,Roboto,Helvetica,sans-serif;color:inherit;white-space:normal;word-wrap:break-word;line-height:22px;margin:0}.x-spreadsheet-editor .x-spreadsheet-editor-area .textline{overflow:hidden;visibility:hidden;position:fixed;top:0;left:0}.x-spreadsheet-item{-webkit-user-select:none;user-select:none;background:0;border:1px solid transparent;outline:none;height:26px;color:#000000e6;line-height:26px;list-style:none;padding:2px 10px;cursor:default;text-align:left;overflow:hidden}.x-spreadsheet-item.disabled{pointer-events:none;opacity:.5}.x-spreadsheet-item:hover,.x-spreadsheet-item.active{background:#0000000d}.x-spreadsheet-item.divider{height:0;padding:0;margin:5px 0;border:none;border-bottom:1px solid rgba(0,0,0,.1)}.x-spreadsheet-item .label{float:right;opacity:.65;font-size:1em}.x-spreadsheet-item.state,.x-spreadsheet-header.state{padding-left:35px!important;position:relative}.x-spreadsheet-item.state:before,.x-spreadsheet-header.state:before{content:"";position:absolute;width:10px;height:10px;left:12px;top:calc(50% - 5px);background:#00000014;border-radius:2px}.x-spreadsheet-item.state.checked:before,.x-spreadsheet-header.state.checked:before{background:#4b89ff}.x-spreadsheet-checkbox{position:relative;display:inline-block;backface-visibility:hidden;outline:0;vertical-align:baseline;font-style:normal;font-size:1rem;line-height:1em}.x-spreadsheet-checkbox>input{position:absolute;top:0;left:0;opacity:0!important;outline:0;z-index:-1}.x-spreadsheet-suggest,.x-spreadsheet-contextmenu,.x-spreadsheet-sort-filter{position:absolute;box-shadow:1px 2px 5px 2px #33333326;background:#fff;z-index:100;width:260px;pointer-events:auto;overflow:auto}.x-spreadsheet-suggest{width:200px}.x-spreadsheet-filter{border:1px solid #e9e9e9;font-size:12px;margin:10px}.x-spreadsheet-filter .x-spreadsheet-header{padding:.5em .75em;background:#f8f8f9;border-bottom:1px solid #e9e9e9;border-left:1px solid transparent}.x-spreadsheet-filter .x-spreadsheet-body{height:200px;overflow-y:auto}.x-spreadsheet-filter .x-spreadsheet-body .x-spreadsheet-item{height:20px;line-height:20px}.x-spreadsheet-sort-filter .x-spreadsheet-buttons{margin:10px}.x-spreadsheet-bottombar{height:40px;padding:0 30px;text-align:left;background:#f5f6f7;display:flex}.x-spreadsheet-bottombar{position:relative;border-top:1px solid #e0e2e4}.x-spreadsheet-bottombar .x-spreadsheet-menu>li{line-height:40px;height:40px;padding-top:0;padding-bottom:0;vertical-align:middle;border-right:1px solid #e8eaed}.x-spreadsheet-menu{display:flex;overflow-x:auto;list-style:none;margin:0;padding:0;-webkit-user-select:none;user-select:none}.x-spreadsheet-menu>li{float:left;line-height:1.25em;padding:.785em 1em;margin:0;vertical-align:middle;text-align:left;font-weight:400;color:#80868b;white-space:nowrap;cursor:pointer;transition:all .3s;font-weight:700}.x-spreadsheet-menu>li.active{background-color:#fff;color:#000000a6}.x-spreadsheet-menu>li .x-spreadsheet-dropdown{display:inline-block}.x-spreadsheet-print{position:absolute;left:0;top:0;z-index:100;width:100%;height:100%;display:flex;flex-direction:column}.x-spreadsheet-print-bar{background:#424242;height:60px;line-height:60px;padding:0 30px}.x-spreadsheet-print-bar .-title{color:#fff;font-weight:700;font-size:1.2em;float:left}.x-spreadsheet-print-bar .-right{float:right;margin-top:12px}.x-spreadsheet-print-content{display:flex;flex:auto;flex-direction:row;background:#d0d0d0;height:calc(100% - 60px)}.x-spreadsheet-print-content .-sider{flex:0 0 300px;width:300px;border-left:2px solid #ccc;background:#fff}.x-spreadsheet-print-content .-content{flex:auto;overflow-x:auto;overflow-y:scroll;height:100%}.x-spreadsheet-canvas-card-wraper{margin:40px 20px}.x-spreadsheet-canvas-card{background:#fff;margin:auto;page-break-before:auto;page-break-after:always;box-shadow:0 8px 10px 1px #00000024,0 3px 14px 3px #0000001f,0 4px 5px #0003}.x-spreadsheet-calendar{color:#000000a6;background:#fff;-webkit-user-select:none;user-select:none}.x-spreadsheet-calendar .calendar-header{font-weight:700;line-height:30px;text-align:center;width:100%;float:left;background:#f9fafb}.x-spreadsheet-calendar .calendar-header .calendar-header-left{padding-left:5px;float:left}.x-spreadsheet-calendar .calendar-header .calendar-header-right{float:right}.x-spreadsheet-calendar .calendar-header .calendar-header-right a{padding:3px 0;margin-right:2px;border-radius:2px}.x-spreadsheet-calendar .calendar-header .calendar-header-right a:hover{background:#00000014}.x-spreadsheet-calendar .calendar-body{border-collapse:collapse;border-spacing:0}.x-spreadsheet-calendar .calendar-body th,.x-spreadsheet-calendar .calendar-body td{width:14.28571429%;min-width:32px;text-align:center;font-weight:700;line-height:30px;padding:0}.x-spreadsheet-calendar .calendar-body td>.cell:hover{background:#ecf6fd}.x-spreadsheet-calendar .calendar-body td>.cell.active,.x-spreadsheet-calendar .calendar-body td>.cell.active:hover{background:#ecf6fd;color:#2185d0}.x-spreadsheet-calendar .calendar-body td>.cell.disabled{pointer-events:none;opacity:.5}.x-spreadsheet-datepicker{box-shadow:2px 2px 5px #0003;position:absolute;left:0;top:calc(100% + 5px);z-index:10;width:auto}.x-spreadsheet-buttons{display:flex;justify-content:flex-end}.x-spreadsheet-buttons .x-spreadsheet-button{margin-left:8px}.x-spreadsheet-button{display:inline-block;border-radius:3px;line-height:1em;min-height:1em;white-space:nowrap;text-align:center;cursor:pointer;font-size:1em;font-weight:700;padding:.75em 1em;color:#0009;background:#e0e1e2;text-decoration:none;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;outline:none;vertical-align:baseline;zoom:1;-webkit-user-select:none;user-select:none;transition:all .1s linear}.x-spreadsheet-button.active,.x-spreadsheet-button:hover{background-color:#c0c1c2;color:#000c}.x-spreadsheet-button.primary{color:#fff;background-color:#2185d0}.x-spreadsheet-button.primary:hover,.x-spreadsheet-button.primary.active{color:#fff;background-color:#1678c2}.x-spreadsheet-form-input{font-size:1em;position:relative;font-weight:400;display:inline-flex;color:#000000de}.x-spreadsheet-form-input input{z-index:1;margin:0;max-width:100%;flex:1 0 auto;outline:0;-webkit-tap-highlight-color:rgba(255,255,255,0);text-align:left;line-height:30px;height:30px;padding:0 8px;background:#fff;border:1px solid #e9e9e9;border-radius:3px;transition:box-shadow .1s ease,border-color .1s ease;box-shadow:inset 0 1px 2px #0a0a0a0f}.x-spreadsheet-form-input input:focus{border-color:#4b89ff;box-shadow:inset 0 1px 2px #4b89ff33}.x-spreadsheet-form-select{position:relative;display:inline-block;background:#fff;border:1px solid #e9e9e9;border-radius:2px;cursor:pointer;color:#000000de;-webkit-user-select:none;user-select:none;box-shadow:inset 0 1px 2px #0a0a0a0f}.x-spreadsheet-form-select .input-text{text-overflow:ellipsis;white-space:nowrap;min-width:60px;width:auto;height:30px;line-height:30px;padding:0 8px}.x-spreadsheet-form-fields{display:flex;flex-direction:row;flex-wrap:wrap}.x-spreadsheet-form-fields .x-spreadsheet-form-field{flex:0 1 auto}.x-spreadsheet-form-fields .x-spreadsheet-form-field .label{display:inline-block;margin:0 10px 0 0}.x-spreadsheet-form-field{display:block;vertical-align:middle;margin-left:10px;margin-bottom:10px}.x-spreadsheet-form-field:first-child{margin-left:0}.x-spreadsheet-form-field.error .x-spreadsheet-form-select,.x-spreadsheet-form-field.error input{border-color:#f04134}.x-spreadsheet-form-field .tip{color:#f04134;font-size:.9em}.x-spreadsheet-dimmer{display:none;position:absolute;top:0!important;left:0!important;width:100%;height:100%;text-align:center;vertical-align:middle;background-color:#0009;opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.5s;animation-duration:.5s;transition:background-color .5s linear;-webkit-user-select:none;user-select:none;z-index:1000}.x-spreadsheet-dimmer.active{display:block;opacity:1}form fieldset{border:none}form fieldset label{display:block;margin-bottom:.5em;font-size:1em;color:#666}form fieldset select{font-size:1.1em;width:100%;background-color:#fff;border:none;border-bottom:2px solid #ddd;padding:.5em .85em;border-radius:2px}.x-spreadsheet-modal,.x-spreadsheet-toast{font-size:13px;position:fixed;z-index:1001;text-align:left;line-height:1.25em;min-width:360px;color:#000000de;font-family:Lato,Source Sans Pro,Roboto,Helvetica,Arial,sans-serif;border-radius:4px;border:1px solid rgba(0,0,0,.1);background-color:#fff;background-clip:padding-box;box-shadow:#0003 0 2px 8px}.x-spreadsheet-toast{background-color:#ffffffd9}.x-spreadsheet-modal-header,.x-spreadsheet-toast-header{font-weight:600;background-clip:padding-box;background-color:#ffffffd9;border-bottom:1px solid rgba(0,0,0,.05);border-radius:4px 4px 0 0}.x-spreadsheet-toast-header{color:#f2711c}.x-spreadsheet-modal-header{border-bottom:1px solid #e0e2e4;background:#00000014;font-size:1.0785em}.x-spreadsheet-modal-header,.x-spreadsheet-modal-content,.x-spreadsheet-toast-header,.x-spreadsheet-toast-content{padding:.75em 1em}.x-spreadsheet-menu li:first-child{display:none}.vue-office-excel{height:100%}.annotationLayer{--annotation-unfocused-field-background:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><rect width="100%" height="100%" style="fill:rgba(0,54,255,.13)"/></svg>');--input-focus-border-color:Highlight;--input-focus-outline:1px solid Canvas;--input-unfocused-border-color:transparent;--input-disabled-border-color:transparent;--input-hover-border-color:#000;--link-outline:none}@media screen and (forced-colors:active){.annotationLayer{--input-focus-border-color:CanvasText;--input-unfocused-border-color:ActiveText;--input-disabled-border-color:GrayText;--input-hover-border-color:Highlight;--link-outline:1.5px solid LinkText}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .textWidgetAnnotation :is(input,textarea):required{outline:1.5px solid selectedItem}.annotationLayer .linkAnnotation{outline:var(--link-outline)}.annotationLayer .popupAnnotation .popup{background-color:ButtonFace!important;color:ButtonText!important;outline:calc(1.5px*var(--scale-factor)) solid CanvasText!important}.annotationLayer .highlightArea:hover:after{-webkit-backdrop-filter:var(--hcm-highlight-filter);backdrop-filter:var(--hcm-highlight-filter);content:"";height:100%;left:0;pointer-events:none;position:absolute;top:0;width:100%}.annotationLayer .popupAnnotation.focused .popup{outline:calc(3px*var(--scale-factor)) solid Highlight!important}}.annotationLayer{left:0;pointer-events:none;position:absolute;top:0;transform-origin:0 0}.annotationLayer[data-main-rotation="90"] .norotate{transform:rotate(270deg) translate(-100%)}.annotationLayer[data-main-rotation="180"] .norotate{transform:rotate(180deg) translate(-100%,-100%)}.annotationLayer[data-main-rotation="270"] .norotate{transform:rotate(90deg) translateY(-100%)}.annotationLayer.disabled .popup,.annotationLayer.disabled section{pointer-events:none}.annotationLayer .annotationContent{height:100%;pointer-events:none;position:absolute;width:100%}.annotationLayer section{box-sizing:border-box;pointer-events:auto;position:absolute;text-align:initial;transform-origin:0 0}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton)>a{font-size:1em;height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer :is(.linkAnnotation,.buttonWidgetAnnotation.pushButton):not(.hasBorder)>a:hover{background-color:#ff0;box-shadow:0 2px 10px #ff0;opacity:.2}.annotationLayer .linkAnnotation.hasBorder:hover{background-color:#ff03}.annotationLayer .hasBorder{background-size:100% 100%}.annotationLayer .textAnnotation img{cursor:pointer;height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input,.annotationLayer .choiceWidgetAnnotation select,.annotationLayer .textWidgetAnnotation :is(input,textarea){background-image:var(--annotation-unfocused-field-background);border:2px solid var(--input-unfocused-border-color);box-sizing:border-box;font:calc(9px*var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:required,.annotationLayer .choiceWidgetAnnotation select:required,.annotationLayer .textWidgetAnnotation :is(input,textarea):required{outline:1.5px solid red}.annotationLayer .choiceWidgetAnnotation select option{padding:0}.annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}.annotationLayer .textWidgetAnnotation textarea{resize:none}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input[disabled],.annotationLayer .choiceWidgetAnnotation select[disabled],.annotationLayer .textWidgetAnnotation [disabled]:is(input,textarea){background:none;border:2px solid var(--input-disabled-border-color);cursor:not-allowed}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input:hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .textWidgetAnnotation :is(input,textarea):hover{border:2px solid var(--input-hover-border-color)}.annotationLayer .buttonWidgetAnnotation.checkBox input:hover,.annotationLayer .choiceWidgetAnnotation select:hover,.annotationLayer .textWidgetAnnotation :is(input,textarea):hover{border-radius:2px}.annotationLayer .choiceWidgetAnnotation select:focus,.annotationLayer .textWidgetAnnotation :is(input,textarea):focus{background:none;border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) :focus{background-color:transparent;background-image:none}.annotationLayer .buttonWidgetAnnotation.checkBox :focus{border:2px solid var(--input-focus-border-color);border-radius:2px;outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.radioButton :focus{border:2px solid var(--input-focus-border-color);outline:var(--input-focus-outline)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before,.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after,.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{height:80%;left:45%;width:1px}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}.annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}.annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:25%;top:25%;width:50%}.annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}.annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}.annotationLayer .buttonWidgetAnnotation:is(.checkBox,.radioButton) input{-webkit-appearance:none;-moz-appearance:none;appearance:none}.annotationLayer .fileAttachmentAnnotation .popupTriggerArea{height:100%;width:100%}.annotationLayer .popupAnnotation{font-size:calc(9px*var(--scale-factor));height:auto;max-width:45%;pointer-events:none;position:absolute;width:-moz-max-content;width:max-content}.annotationLayer .popup{background-color:#ff9;border-radius:calc(2px*var(--scale-factor));box-shadow:0 calc(2px*var(--scale-factor)) calc(5px*var(--scale-factor)) #888;cursor:pointer;font:message-box;outline:1.5px solid #ffff4a;padding:calc(6px*var(--scale-factor));white-space:normal;word-wrap:break-word;pointer-events:auto}.annotationLayer .popupAnnotation.focused .popup{outline-width:3px}.annotationLayer .popup *{font-size:calc(9px*var(--scale-factor))}.annotationLayer .popup>.header{display:inline-block}.annotationLayer .popup>.header h1{display:inline}.annotationLayer .popup>.header .popupDate{display:inline-block;margin-left:calc(5px*var(--scale-factor));width:-moz-fit-content;width:fit-content}.annotationLayer .popupContent{border-top:1px solid #333;margin-top:calc(2px*var(--scale-factor));padding-top:calc(2px*var(--scale-factor))}.annotationLayer .richText>*{font-size:calc(9px*var(--scale-factor));white-space:pre-wrap}.annotationLayer .popupTriggerArea{cursor:pointer}.annotationLayer section svg{height:100%;left:0;position:absolute;top:0;width:100%}.annotationLayer .annotationTextContent{color:transparent;height:100%;opacity:0;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.annotationLayer svg.quadrilateralsContainer{contain:strict;height:0;left:0;position:absolute;top:0;width:0;z-index:-1}.textLayer{inset:0;line-height:1;opacity:1;overflow:clip;position:absolute;text-align:initial;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;caret-color:CanvasText;forced-color-adjust:none;transform-origin:0 0;z-index:0}.textLayer.highlighting{touch-action:none}.textLayer :is(span,br){color:transparent;cursor:text;position:absolute;transform-origin:0 0;white-space:pre}.textLayer .markedContent span:not(.markedContent),.textLayer>:not(.markedContent){z-index:1}.textLayer span.markedContent{height:0;top:0}.textLayer span[role=img]{cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textLayer .highlight{--highlight-bg-color:rgba(180,0,170,.25);--highlight-selected-bg-color:rgba(0,100,0,.25);--highlight-backdrop-filter:none;--highlight-selected-backdrop-filter:none}@media screen and (forced-colors:active){.textLayer .highlight{--highlight-bg-color:transparent;--highlight-selected-bg-color:transparent;--highlight-backdrop-filter:var(--hcm-highlight-filter);--highlight-selected-backdrop-filter:var( --hcm-highlight-selected-filter )}}.textLayer .highlight{-webkit-backdrop-filter:var(--highlight-backdrop-filter);backdrop-filter:var(--highlight-backdrop-filter);background-color:var(--highlight-bg-color);border-radius:4px;margin:-1px;padding:1px}.textLayer ::-moz-selection{background:#0000ff40;background:color-mix(in srgb,AccentColor,transparent 75%)}.textLayer ::selection{background:#0000ff40;background:color-mix(in srgb,AccentColor,transparent 75%)}.textLayer br::-moz-selection{background:transparent}.textLayer br::selection{background:transparent}.textLayer .endOfContent{cursor:default;display:block;inset:100% 0 0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:0}.textLayer.selecting .endOfContent{top:0}.textLayer.selecting~.annotationLayer section{pointer-events:none}.textLayer.highlighting{cursor:var(--editorFreeHighlight-editing-cursor)}.textLayer.highlighting:not(.free) span{cursor:var(--editorHighlight-editing-cursor)}.textLayer.highlighting.free span{cursor:var(--editorFreeHighlight-editing-cursor)}[data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[data-main-rotation="270"]{transform:rotate(270deg) translate(-100%)}#hiddenCopyElement,.hiddenCanvasElement{display:none;height:0;left:0;position:absolute;top:0;width:0}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"office-preview.es.js","sources":["../src/components/office-preview.vue","../src/index.ts"],"sourcesContent":["<!--\n * @Title: office-preview\n * @Author: diaojw\n * @Package: components,.*\n * @Date: 2026/03/19 14:05\n * @description: 在线预览文件组件\n -->\n<template>\n <div class=\"file-preview-container\">\n <!-- 预览区域 -->\n <div class=\"preview-area\">\n <div>在线预览</div>\n <div>{{ fileUrl }}</div>\n <!-- PDF 预览 -->\n <!-- <VuePdfEmbed v-if=\"activeType === 'pdf' && fileUrl\" annotation-layer text-layer :source=\"fileUrl\" style=\"height: 500px;\"/> -->\n <!-- <div :src=\"fileUrl\" style=\"height: 100%;width: 100%;\" id=\"pptx-wrapper\"></div> -->\n </div>\n\n <!-- 加载状态 -->\n <div v-if=\"loading\" class=\"loading-mask\">\n <div class=\"loading-content\">\n <div class=\"spinner\"></div>\n <p>正在加载文件...</p>\n </div>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\n// 按需引入\nimport { watch, ref, onMounted } from 'vue'\n\n\nlet activeType = ref<string>('pdf') // 当前预览的文件类型\nlet loading = ref(false)\n\nconst props = withDefaults(defineProps<{\n fileUrl: string,\n fileType: string,\n height? : string,\n}>(), {\n fileUrl: '',\n fileType: '',\n height: '100%'\n})\nconst emit = defineEmits(['rendered'])\n\nconst detectFileType = (fileName: string) => {\n console.log('fileName', fileName)\n const ext: any = fileName.toLowerCase().split('.').pop()\n if (['pdf'].includes(ext)) {\n activeType.value = 'pdf'\n } else if (['doc', 'docx'].includes(ext)) {\n activeType.value = 'doc'\n } else if (['xls', 'xlsx', 'csv'].includes(ext)) {\n activeType.value = 'xls'\n } else if (['ppt', 'pptx'].includes(ext)) {\n activeType.value = 'ppt'\n console.log('pptxPrviewer', fileName)\n } else {\n activeType.value = 'other'\n }\n}\nwatch([() => props.fileType, () => props.fileUrl], (newType) => {\n activeType.value = newType[0];\n detectFileType(newType[1])\n // activeType.value = newType[1];\n}, {\n immediate: true\n})\ndefineOptions({\n name: 'OfficePreview', // 一定要有 name\n})\n\nonMounted(async () => {\n // const response = await fetch('/file/123.pdf'); // 确保public目录有该文件\n // const blob = await response.blob();\n // docxUrl.value = URL.createObjectURL(blob);\n})\n\n// 渲染完成回调\n\n\n</script>\n\n<style scoped>\n.file-preview-container {\n height: 100%;\n}\n\n.preview-area {\n height: 100%;\n}\n</style>\n","/**\n * @Title: index\n * @Author diaojw\n * @Package\n * @Date 2026/3/19 21:31\n * @description: 这里导出组件\n */\n\nimport type { App } from 'vue'\nimport OfficePreview from './components/office-preview.vue'\n// import ExampleDom1 from '../src/components/ExampleDom1.vue'; // 如果有多个组件一起打包\n\nconst components = [OfficePreview]\n// const components = [OfficePreview, ExampleDom1]; // 如果有多个组件一起打包\n\nexport { OfficePreview } // 按需引入\n// export { ExampleDom, ExampleDom1 }; // 按需引入,如果有多个组件一起打包就可以一起写\n\nconst install = (app: App) => {\n components.forEach((component) => {\n app.component(component.name as string, component)\n })\n}\nexport default { install }\n"],"names":["activeType","ref","loading","props","__props","detectFileType","fileName","ext","watch","newType","onMounted","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_cache","_unref","_hoisted_3","components","OfficePreview","install","app","component","index"],"mappings":";;;;;;;;;;;;;;AAgCA,QAAIA,IAAaC,EAAY,KAAK,GAC9BC,IAAUD,EAAI,EAAK;AAEvB,UAAME,IAAQC,GAWRC,IAAiB,CAACC,MAAqB;AAC3C,cAAQ,IAAI,YAAYA,CAAQ;AAChC,YAAMC,IAAWD,EAAS,YAAA,EAAc,MAAM,GAAG,EAAE,IAAA;AACnD,MAAI,CAAC,KAAK,EAAE,SAASC,CAAG,IACtBP,EAAW,QAAQ,QACV,CAAC,OAAO,MAAM,EAAE,SAASO,CAAG,IACrCP,EAAW,QAAQ,QACV,CAAC,OAAO,QAAQ,KAAK,EAAE,SAASO,CAAG,IAC5CP,EAAW,QAAQ,QACV,CAAC,OAAO,MAAM,EAAE,SAASO,CAAG,KACrCP,EAAW,QAAQ,OACnB,QAAQ,IAAI,gBAAgBM,CAAQ,KAEpCN,EAAW,QAAQ;AAAA,IAEvB;AACA,WAAAQ,EAAM,CAAC,MAAML,EAAM,UAAU,MAAMA,EAAM,OAAO,GAAG,CAACM,MAAY;AAC9D,MAAAT,EAAW,QAAQS,EAAQ,CAAC,GAC5BJ,EAAeI,EAAQ,CAAC,CAAC;AAAA,IAE3B,GAAG;AAAA,MACD,WAAW;AAAA,IAAA,CACZ,GAKDC,EAAU,YAAY;AAAA,IAItB,CAAC,cArECC,EAAA,GAAAC,EAiBM,OAjBNC,GAiBM;AAAA,MAfJC,EAMM,OANNC,GAMM;AAAA,QALJC,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAAF,EAAe,aAAV,QAAI,EAAA;AAAA,QACTA,EAAwB,eAAhBV,EAAA,OAAO,GAAA,CAAA;AAAA,MAAA;MAONa,EAAAf,CAAA,KAAXS,EAAA,GAAAC,EAKM,OALNM,GAKM,CAAA,GAAAF,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,QAJJF,EAGM,OAAA,EAHD,OAAM,qBAAiB;AAAA,UAC1BA,EAA2B,OAAA,EAAtB,OAAM,WAAS;AAAA,UACpBA,EAAgB,WAAb,WAAS;AAAA,QAAA;;;;;;;;;iECVdK,IAAa,CAACC,CAAa,GAM3BC,IAAU,CAACC,MAAa;AAC5B,EAAAH,EAAW,QAAQ,CAACI,MAAc;AAChC,IAAAD,EAAI,UAAUC,EAAU,MAAgBA,CAAS;AAAA,EACnD,CAAC;AACH,GACAC,IAAe,EAAE,SAAAH,EAAA;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"office-preview.umd.js","sources":["../src/components/office-preview.vue","../src/index.ts"],"sourcesContent":["<!--\n * @Title: office-preview\n * @Author: diaojw\n * @Package: components,.*\n * @Date: 2026/03/19 14:05\n * @description: 在线预览文件组件\n -->\n<template>\n <div class=\"file-preview-container\">\n <!-- 预览区域 -->\n <div class=\"preview-area\">\n <div>在线预览</div>\n <div>{{ fileUrl }}</div>\n <!-- PDF 预览 -->\n <!-- <VuePdfEmbed v-if=\"activeType === 'pdf' && fileUrl\" annotation-layer text-layer :source=\"fileUrl\" style=\"height: 500px;\"/> -->\n <!-- <div :src=\"fileUrl\" style=\"height: 100%;width: 100%;\" id=\"pptx-wrapper\"></div> -->\n </div>\n\n <!-- 加载状态 -->\n <div v-if=\"loading\" class=\"loading-mask\">\n <div class=\"loading-content\">\n <div class=\"spinner\"></div>\n <p>正在加载文件...</p>\n </div>\n </div>\n </div>\n</template>\n<script lang=\"ts\" setup>\n// 按需引入\nimport { watch, ref, onMounted } from 'vue'\n\n\nlet activeType = ref<string>('pdf') // 当前预览的文件类型\nlet loading = ref(false)\n\nconst props = withDefaults(defineProps<{\n fileUrl: string,\n fileType: string,\n height? : string,\n}>(), {\n fileUrl: '',\n fileType: '',\n height: '100%'\n})\nconst emit = defineEmits(['rendered'])\n\nconst detectFileType = (fileName: string) => {\n console.log('fileName', fileName)\n const ext: any = fileName.toLowerCase().split('.').pop()\n if (['pdf'].includes(ext)) {\n activeType.value = 'pdf'\n } else if (['doc', 'docx'].includes(ext)) {\n activeType.value = 'doc'\n } else if (['xls', 'xlsx', 'csv'].includes(ext)) {\n activeType.value = 'xls'\n } else if (['ppt', 'pptx'].includes(ext)) {\n activeType.value = 'ppt'\n console.log('pptxPrviewer', fileName)\n } else {\n activeType.value = 'other'\n }\n}\nwatch([() => props.fileType, () => props.fileUrl], (newType) => {\n activeType.value = newType[0];\n detectFileType(newType[1])\n // activeType.value = newType[1];\n}, {\n immediate: true\n})\ndefineOptions({\n name: 'OfficePreview', // 一定要有 name\n})\n\nonMounted(async () => {\n // const response = await fetch('/file/123.pdf'); // 确保public目录有该文件\n // const blob = await response.blob();\n // docxUrl.value = URL.createObjectURL(blob);\n})\n\n// 渲染完成回调\n\n\n</script>\n\n<style scoped>\n.file-preview-container {\n height: 100%;\n}\n\n.preview-area {\n height: 100%;\n}\n</style>\n","/**\n * @Title: index\n * @Author diaojw\n * @Package\n * @Date 2026/3/19 21:31\n * @description: 这里导出组件\n */\n\nimport type { App } from 'vue'\nimport OfficePreview from './components/office-preview.vue'\n// import ExampleDom1 from '../src/components/ExampleDom1.vue'; // 如果有多个组件一起打包\n\nconst components = [OfficePreview]\n// const components = [OfficePreview, ExampleDom1]; // 如果有多个组件一起打包\n\nexport { OfficePreview } // 按需引入\n// export { ExampleDom, ExampleDom1 }; // 按需引入,如果有多个组件一起打包就可以一起写\n\nconst install = (app: App) => {\n components.forEach((component) => {\n app.component(component.name as string, component)\n })\n}\nexport default { install }\n"],"names":["activeType","ref","loading","props","__props","detectFileType","fileName","ext","watch","newType","onMounted","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_cache","_unref","_hoisted_3","components","OfficePreview","index","app","component"],"mappings":"+lBAgCA,IAAIA,EAAaC,EAAAA,IAAY,KAAK,EAC9BC,EAAUD,EAAAA,IAAI,EAAK,EAEvB,MAAME,EAAQC,EAWRC,EAAkBC,GAAqB,CAC3C,QAAQ,IAAI,WAAYA,CAAQ,EAChC,MAAMC,EAAWD,EAAS,YAAA,EAAc,MAAM,GAAG,EAAE,IAAA,EAC/C,CAAC,KAAK,EAAE,SAASC,CAAG,EACtBP,EAAW,MAAQ,MACV,CAAC,MAAO,MAAM,EAAE,SAASO,CAAG,EACrCP,EAAW,MAAQ,MACV,CAAC,MAAO,OAAQ,KAAK,EAAE,SAASO,CAAG,EAC5CP,EAAW,MAAQ,MACV,CAAC,MAAO,MAAM,EAAE,SAASO,CAAG,GACrCP,EAAW,MAAQ,MACnB,QAAQ,IAAI,eAAgBM,CAAQ,GAEpCN,EAAW,MAAQ,OAEvB,EACAQ,OAAAA,QAAM,CAAC,IAAML,EAAM,SAAU,IAAMA,EAAM,OAAO,EAAIM,GAAY,CAC9DT,EAAW,MAAQS,EAAQ,CAAC,EAC5BJ,EAAeI,EAAQ,CAAC,CAAC,CAE3B,EAAG,CACD,UAAW,EAAA,CACZ,EAKDC,EAAAA,UAAU,SAAY,CAItB,CAAC,UArECC,YAAA,EAAAC,qBAiBM,MAjBNC,EAiBM,CAfJC,EAAAA,mBAMM,MANNC,EAMM,CALJC,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAF,qBAAe,WAAV,OAAI,EAAA,GACTA,EAAAA,mBAAwB,6BAAhBV,EAAA,OAAO,EAAA,CAAA,CAAA,GAONa,EAAAA,MAAAf,CAAA,GAAXS,YAAA,EAAAC,EAAAA,mBAKM,MALNM,EAKM,CAAA,GAAAF,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAA,CAJJF,EAAAA,mBAGM,MAAA,CAHD,MAAM,mBAAiB,CAC1BA,EAAAA,mBAA2B,MAAA,CAAtB,MAAM,UAAS,EACpBA,qBAAgB,SAAb,WAAS,CAAA,gFCVdK,EAAa,CAACC,CAAa,EAWjCC,EAAe,CAAE,QALAC,GAAa,CAC5BH,EAAW,QAASI,GAAc,CAChCD,EAAI,UAAUC,EAAU,KAAgBA,CAAS,CACnD,CAAC,CACH,CACiB"}
|
package/dist/src/App.vue.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
-
export default _default;
|
package/dist/src/App.vue.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ref } from 'vue';
|
|
2
|
-
import OfficePreview from '@/components/office-preview.vue';
|
|
3
|
-
const currentFile = ref({
|
|
4
|
-
url: '/file/234.docx',
|
|
5
|
-
type: 'docx',
|
|
6
|
-
name: '示例文档.pdf'
|
|
7
|
-
});
|
|
8
|
-
const onFileRendered = () => {
|
|
9
|
-
console.log('文件已渲染完成');
|
|
10
|
-
};
|
|
11
|
-
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
12
|
-
const __VLS_ctx = {};
|
|
13
|
-
let __VLS_components;
|
|
14
|
-
let __VLS_directives;
|
|
15
|
-
// CSS variable injection
|
|
16
|
-
// CSS variable injection end
|
|
17
|
-
/** @type {[typeof OfficePreview, typeof OfficePreview, ]} */ ;
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
const __VLS_0 = __VLS_asFunctionalComponent(OfficePreview, new OfficePreview({
|
|
20
|
-
...{ 'onRendered': {} },
|
|
21
|
-
fileUrl: (__VLS_ctx.currentFile.url),
|
|
22
|
-
fileType: (__VLS_ctx.currentFile.type),
|
|
23
|
-
}));
|
|
24
|
-
const __VLS_1 = __VLS_0({
|
|
25
|
-
...{ 'onRendered': {} },
|
|
26
|
-
fileUrl: (__VLS_ctx.currentFile.url),
|
|
27
|
-
fileType: (__VLS_ctx.currentFile.type),
|
|
28
|
-
}, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
29
|
-
let __VLS_3;
|
|
30
|
-
let __VLS_4;
|
|
31
|
-
let __VLS_5;
|
|
32
|
-
const __VLS_6 = {
|
|
33
|
-
onRendered: (__VLS_ctx.onFileRendered)
|
|
34
|
-
};
|
|
35
|
-
var __VLS_7 = {};
|
|
36
|
-
var __VLS_2;
|
|
37
|
-
var __VLS_dollars;
|
|
38
|
-
const __VLS_self = (await import('vue')).defineComponent({
|
|
39
|
-
setup() {
|
|
40
|
-
return {
|
|
41
|
-
OfficePreview: OfficePreview,
|
|
42
|
-
currentFile: currentFile,
|
|
43
|
-
onFileRendered: onFileRendered,
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
export default (await import('vue')).defineComponent({
|
|
48
|
-
setup() {
|
|
49
|
-
return {};
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
; /* PartiallyEnd: #4569/main.vue */
|
|
53
|
-
//# sourceMappingURL=App.vue.js.map
|
package/dist/src/App.vue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"App.vue.js","sourceRoot":"","sources":["../../src/App.vue"],"names":[],"mappings":"AACA,OAwBO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACzB,OAAO,aAAa,MAAM,iCAAiC,CAAA;AAC3D,MAAM,WAAW,GAAG,GAAG,CAAC;IACtB,GAAG,EAAE,gBAAgB;IACrB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,UAAU;CACjB,CAAC,CAAA;AAGF,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACxB,CAAC,CAAA;AACD,QAAQ,CAAA,CAAA,yCAAyC;AAIjD,MAAM,SAAS,GAAG,EAAqE,CAAC;AAExF,IAAI,gBAAiE,CAAC;AAEtE,IAAI,gBAAiE,CAAC;AAEtE,0BAA0B;AAC1B,8BAA8B;AAC9B,6DAA6D,CAAA,CAAC;AAC9D,aAAa;AACb,MAAM,OAAO,GAAG,2BAA2B,CAAC,aAAa,EAAE,IAAI,aAAa,CAAC;IAC7E,GAAG,EAAE,YAAY,EAAE,EAAS,EAAE;IAC9B,OAAO,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC;IACpC,QAAQ,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;CACrC,CAAC,CAAC,CAAC;AACJ,MAAM,OAAO,GAAG,OAAO,CAAC;IACxB,GAAG,EAAE,YAAY,EAAE,EAAS,EAAE;IAC9B,OAAO,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC;IACpC,QAAQ,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;CACrC,EAAE,GAAG,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC;AAClD,IAAI,OAA6B,CAAC;AAClC,IAAI,OAA8C,CAAC;AACnD,IAAI,OAAwE,CAAC;AAC7E,MAAM,OAAO,GAAwG;IACrH,UAAU,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC;CAAC,CAAC;AACxC,IAAI,OAAO,GAAG,EAAmE,CAAC;AAClF,IAAI,OAAgF,CAAC;AAOrF,IAAI,aAK+D,CAAC;AACpE,MAAM,UAAU,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC;IACzD,KAAK;QACL,OAAO;YACP,aAAa,EAAE,aAAqC;YACpD,WAAW,EAAE,WAAiC;YAC9C,cAAc,EAAE,cAAuC;SACtD,CAAC;IACF,CAAC;CACA,CAAC,CAAC;AACH,eAAe,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC;IACrD,KAAK;QACL,OAAO,EACN,CAAC;IACF,CAAC;CACA,CAAC,CAAC;AACH,CAAC,CAAA,kCAAkC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
type __VLS_Props = {
|
|
2
|
-
fileUrl: string;
|
|
3
|
-
fileType: string;
|
|
4
|
-
height?: string;
|
|
5
|
-
};
|
|
6
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
-
rendered: (...args: any[]) => void;
|
|
8
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
-
onRendered?: ((...args: any[]) => any) | undefined;
|
|
10
|
-
}>, {
|
|
11
|
-
fileUrl: string;
|
|
12
|
-
fileType: string;
|
|
13
|
-
height: string;
|
|
14
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
-
export default _default;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { watch, ref, onMounted } from 'vue';
|
|
2
|
-
let activeType = ref('pdf'); // 当前预览的文件类型
|
|
3
|
-
let loading = ref(false);
|
|
4
|
-
const props = withDefaults(defineProps(), {
|
|
5
|
-
fileUrl: '',
|
|
6
|
-
fileType: '',
|
|
7
|
-
height: '100%'
|
|
8
|
-
});
|
|
9
|
-
const emit = defineEmits(['rendered']);
|
|
10
|
-
const detectFileType = (fileName) => {
|
|
11
|
-
console.log('fileName', fileName);
|
|
12
|
-
const ext = fileName.toLowerCase().split('.').pop();
|
|
13
|
-
if (['pdf'].includes(ext)) {
|
|
14
|
-
activeType.value = 'pdf';
|
|
15
|
-
}
|
|
16
|
-
else if (['doc', 'docx'].includes(ext)) {
|
|
17
|
-
activeType.value = 'doc';
|
|
18
|
-
}
|
|
19
|
-
else if (['xls', 'xlsx', 'csv'].includes(ext)) {
|
|
20
|
-
activeType.value = 'xls';
|
|
21
|
-
}
|
|
22
|
-
else if (['ppt', 'pptx'].includes(ext)) {
|
|
23
|
-
activeType.value = 'ppt';
|
|
24
|
-
console.log('pptxPrviewer', fileName);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
activeType.value = 'other';
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
watch([() => props.fileType, () => props.fileUrl], (newType) => {
|
|
31
|
-
activeType.value = newType[0];
|
|
32
|
-
detectFileType(newType[1]);
|
|
33
|
-
// activeType.value = newType[1];
|
|
34
|
-
}, {
|
|
35
|
-
immediate: true
|
|
36
|
-
});
|
|
37
|
-
defineOptions({
|
|
38
|
-
name: 'OfficePreview', // 一定要有 name
|
|
39
|
-
});
|
|
40
|
-
onMounted(async () => {
|
|
41
|
-
// const response = await fetch('/file/123.pdf'); // 确保public目录有该文件
|
|
42
|
-
// const blob = await response.blob();
|
|
43
|
-
// docxUrl.value = URL.createObjectURL(blob);
|
|
44
|
-
});
|
|
45
|
-
// 渲染完成回调
|
|
46
|
-
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
47
|
-
const __VLS_withDefaultsArg = (function (t) { return t; })({
|
|
48
|
-
fileUrl: '',
|
|
49
|
-
fileType: '',
|
|
50
|
-
height: '100%'
|
|
51
|
-
});
|
|
52
|
-
const __VLS_ctx = {};
|
|
53
|
-
let __VLS_components;
|
|
54
|
-
let __VLS_directives;
|
|
55
|
-
// CSS variable injection
|
|
56
|
-
// CSS variable injection end
|
|
57
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
|
|
58
|
-
...{ class: "file-preview-container" },
|
|
59
|
-
});
|
|
60
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
|
|
61
|
-
...{ class: "preview-area" },
|
|
62
|
-
});
|
|
63
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
|
|
64
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
|
|
65
|
-
(__VLS_ctx.fileUrl);
|
|
66
|
-
if (__VLS_ctx.loading) {
|
|
67
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
|
|
68
|
-
...{ class: "loading-mask" },
|
|
69
|
-
});
|
|
70
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
|
|
71
|
-
...{ class: "loading-content" },
|
|
72
|
-
});
|
|
73
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({
|
|
74
|
-
...{ class: "spinner" },
|
|
75
|
-
});
|
|
76
|
-
__VLS_asFunctionalElement(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({});
|
|
77
|
-
}
|
|
78
|
-
/** @type {__VLS_StyleScopedClasses['file-preview-container']} */ ;
|
|
79
|
-
/** @type {__VLS_StyleScopedClasses['preview-area']} */ ;
|
|
80
|
-
/** @type {__VLS_StyleScopedClasses['loading-mask']} */ ;
|
|
81
|
-
/** @type {__VLS_StyleScopedClasses['loading-content']} */ ;
|
|
82
|
-
/** @type {__VLS_StyleScopedClasses['spinner']} */ ;
|
|
83
|
-
var __VLS_dollars;
|
|
84
|
-
const __VLS_self = (await import('vue')).defineComponent({
|
|
85
|
-
setup() {
|
|
86
|
-
return {
|
|
87
|
-
loading: loading,
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
emits: {},
|
|
91
|
-
__typeProps: {},
|
|
92
|
-
props: {},
|
|
93
|
-
});
|
|
94
|
-
export default (await import('vue')).defineComponent({
|
|
95
|
-
setup() {
|
|
96
|
-
return {};
|
|
97
|
-
},
|
|
98
|
-
emits: {},
|
|
99
|
-
__typeProps: {},
|
|
100
|
-
props: {},
|
|
101
|
-
});
|
|
102
|
-
; /* PartiallyEnd: #4569/main.vue */
|
|
103
|
-
//# sourceMappingURL=office-preview.vue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"office-preview.vue.js","sourceRoot":"","sources":["../../../src/components/office-preview.vue"],"names":[],"mappings":"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"}
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Title: index
|
|
3
|
-
* @Author diaojw
|
|
4
|
-
* @Package
|
|
5
|
-
* @Date 2026/3/19 21:31
|
|
6
|
-
* @description: 这里导出组件
|
|
7
|
-
*/
|
|
8
|
-
import type { App } from 'vue';
|
|
9
|
-
import OfficePreview from './components/office-preview.vue';
|
|
10
|
-
export { OfficePreview };
|
|
11
|
-
declare const _default: {
|
|
12
|
-
install: (app: App) => void;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
package/dist/src/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @Title: index
|
|
3
|
-
* @Author diaojw
|
|
4
|
-
* @Package
|
|
5
|
-
* @Date 2026/3/19 21:31
|
|
6
|
-
* @description: 这里导出组件
|
|
7
|
-
*/
|
|
8
|
-
import OfficePreview from './components/office-preview.vue';
|
|
9
|
-
// import ExampleDom1 from '../src/components/ExampleDom1.vue'; // 如果有多个组件一起打包
|
|
10
|
-
const components = [OfficePreview];
|
|
11
|
-
// const components = [OfficePreview, ExampleDom1]; // 如果有多个组件一起打包
|
|
12
|
-
export { OfficePreview }; // 按需引入
|
|
13
|
-
// export { ExampleDom, ExampleDom1 }; // 按需引入,如果有多个组件一起打包就可以一起写
|
|
14
|
-
const install = (app) => {
|
|
15
|
-
components.forEach((component) => {
|
|
16
|
-
app.component(component.name, component);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export default { install };
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,aAAa,MAAM,iCAAiC,CAAA;AAC3D,8EAA8E;AAE9E,MAAM,UAAU,GAAG,CAAC,aAAa,CAAC,CAAA;AAClC,kEAAkE;AAElE,OAAO,EAAE,aAAa,EAAE,CAAA,CAAC,OAAO;AAChC,gEAAgE;AAEhE,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAE,EAAE;IAC3B,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;QAC/B,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,IAAc,EAAE,SAAS,CAAC,CAAA;IACpD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AACD,eAAe,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/src/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './assets/main.css';
|
package/dist/src/main.js
DELETED
package/dist/src/main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAA;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,GAAG,MAAM,WAAW,CAAA;AAE3B,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/main.ts","../src/types/vue-office.d.ts","../src/app.vue","../src/components/office-preview.vue","../vite.config.ts"],"version":"5.8.3"}
|
package/dist/vite.config.d.ts
DELETED
package/dist/vite.config.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath, URL } from 'node:url';
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import vue from '@vitejs/plugin-vue';
|
|
4
|
-
import vueDevTools from 'vite-plugin-vue-devtools';
|
|
5
|
-
import dts from 'vite-plugin-dts';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
// https://vite.dev/config/
|
|
8
|
-
export default defineConfig({
|
|
9
|
-
plugins: [
|
|
10
|
-
vue(),
|
|
11
|
-
vueDevTools(),
|
|
12
|
-
dts({
|
|
13
|
-
outDir: 'dist', // 打包文件名
|
|
14
|
-
insertTypesEntry: true,
|
|
15
|
-
include: ['src'],
|
|
16
|
-
}),
|
|
17
|
-
],
|
|
18
|
-
// optimizeDeps: {
|
|
19
|
-
// include: ['@vue-office/docx', '@vue-office/excel', '@vue-office/pdf']
|
|
20
|
-
// },
|
|
21
|
-
resolve: {
|
|
22
|
-
alias: {
|
|
23
|
-
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
build: {
|
|
27
|
-
sourcemap: true,
|
|
28
|
-
// 避免dist被清空
|
|
29
|
-
emptyOutDir: false,
|
|
30
|
-
// 如果不想被别人直接看到源码就用这个lib方式
|
|
31
|
-
lib: {
|
|
32
|
-
// 入口文件
|
|
33
|
-
entry: path.resolve(__dirname, 'src/index.ts'),
|
|
34
|
-
// // 暴露的全局变量的名字,这个名字可以自定义,最好是你的包的名字
|
|
35
|
-
name: 'office-preview',
|
|
36
|
-
// 输出的文件名,这里和上面的 name 最好保持一致
|
|
37
|
-
fileName: (format) => `office-preview.${format}.js`,
|
|
38
|
-
},
|
|
39
|
-
rollupOptions: {
|
|
40
|
-
external: ['vue'], // 把不想打包进你的包的包排除掉
|
|
41
|
-
output: {
|
|
42
|
-
format: 'es',
|
|
43
|
-
// 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
|
|
44
|
-
globals: {
|
|
45
|
-
vue: 'Vue',
|
|
46
|
-
},
|
|
47
|
-
// 使用命名模式导出,也可以不设置即使用默认模式。二者的区别就是使用组件时是否要带{}: import { example } from "example"; or import example from "example"
|
|
48
|
-
exports: 'named',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=vite.config.js.map
|
package/dist/vite.config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.config.js","sourceRoot":"","sources":["../vite.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,GAAG,MAAM,oBAAoB,CAAA;AACpC,OAAO,WAAW,MAAM,0BAA0B,CAAA;AAClD,OAAO,GAAG,MAAM,iBAAiB,CAAA;AACjC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,2BAA2B;AAC3B,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE;QACP,GAAG,EAAE;QACL,WAAW,EAAE;QACb,GAAG,CAAC;YACF,MAAM,EAAE,MAAM,EAAE,QAAQ;YACxB,gBAAgB,EAAE,IAAI;YACtB,OAAO,EAAE,CAAC,KAAK,CAAC;SACjB,CAAC;KACH;IACD,mBAAmB;IACnB,0EAA0E;IAC1E,KAAK;IACL,OAAO,EAAE;QACP,KAAK,EAAE;YACL,GAAG,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACtD;KACF;IACD,KAAK,EAAE;QACL,SAAS,EAAE,IAAI;QACf,YAAY;QACZ,WAAW,EAAE,KAAK;QAClB,yBAAyB;QACzB,GAAG,EAAE;YACH,OAAO;YACP,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC;YAC9C,oCAAoC;YACpC,IAAI,EAAE,gBAAgB;YACtB,4BAA4B;YAE5B,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,MAAM,KAAK;SACpD;QACD,aAAa,EAAE;YACb,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,iBAAiB;YACpC,MAAM,EAAE;gBACN,MAAM,EAAE,IAAI;gBACZ,+BAA+B;gBAC/B,OAAO,EAAE;oBACP,GAAG,EAAE,KAAK;iBACX;gBACD,iHAAiH;gBACjH,OAAO,EAAE,OAAO;aACjB;SACF;KACF;CACF,CAAC,CAAA"}
|