Skip to content

Commit

Permalink
feat: 添加WordExcel预览示例
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxian521 committed Mar 23, 2024
1 parent 51ef364 commit 4f44f72
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build/optimize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const include = [
"vue-json-pretty",
"@logicflow/core",
"@pureadmin/utils",
"@vue-office/docx",
"@vue-office/excel",
"@wangeditor/editor",
"responsive-storage",
"plus-pro-components",
Expand Down
2 changes: 2 additions & 0 deletions locales/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ menus:
hsSwiper: Swiper Plugin
hsVirtualList: Virtual List
hsPdf: PDF Preview
hsWord: Word Preview
hsExcels: Excel Preview
hsExcel: Export Excel
hsInfiniteScroll: Table Infinite Scroll
hsSensitive: Sensitive Filter
Expand Down
2 changes: 2 additions & 0 deletions locales/zh-CN.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ menus:
hsSwiper: Swiper插件
hsVirtualList: 虚拟列表
hsPdf: PDF预览
hsWord: Word预览
hsExcels: Excel预览
hsExcel: 导出Excel
hsInfiniteScroll: 表格无限滚动
hsSensitive: 敏感词过滤
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"@pureadmin/utils": "^2.4.7",
"@vue-flow/background": "^1.3.0",
"@vue-flow/core": "^1.33.4",
"@vue-office/docx": "^1.6.0",
"@vue-office/excel": "^1.7.2",
"@vueuse/core": "^10.9.0",
"@vueuse/motion": "^2.1.0",
"@wangeditor/editor": "^5.1.23",
Expand Down
36 changes: 36 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions src/router/modules/able.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ export default {
}
}
},
{
path: "/able/word",
name: "Word",
component: () => import("@/views/able/word.vue"),
meta: {
title: $t("menus.hsWord")
}
},
{
path: "/able/excels",
name: "Excels",
component: () => import("@/views/able/excels.vue"),
meta: {
title: $t("menus.hsExcels")
}
},
{
path: "/able/pdf",
name: "Pdf",
Expand Down
27 changes: 27 additions & 0 deletions src/views/able/excels.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script setup lang="ts">
import "@vue-office/excel/lib/index.css";
import VueOfficeExcel from "@vue-office/excel";
defineOptions({
name: "Excels"
});
const excel = "https://xiaoxian521.github.io/hyperlink/other/excel.xlsx";
function renderedHandler() {
console.log("渲染完成");
}
function errorHandler() {
console.log("渲染失败");
}
</script>

<template>
<vue-office-excel
:src="excel"
style="height: 100vh"
@rendered="renderedHandler"
@error="errorHandler"
/>
</template>
18 changes: 18 additions & 0 deletions src/views/able/word.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script setup lang="ts">
import "@vue-office/docx/lib/index.css";
import VueOfficeDocx from "@vue-office/docx";
defineOptions({
name: "Word"
});
const docx = "https://xiaoxian521.github.io/hyperlink/other/word.docx";
function rendered() {
console.log("渲染完成");
}
</script>

<template>
<vue-office-docx :src="docx" @rendered="rendered" />
</template>

0 comments on commit 4f44f72

Please sign in to comment.