From 63ef06202e78890b7fd5444a6d15e45e59901fb2 Mon Sep 17 00:00:00 2001 From: donghaolin <17667510818@163.com> Date: Thu, 26 Dec 2024 11:03:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=BA=86excel=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/gold-system/README.md | 19 ++++++++++--------- vue/gold-system/package-lock.json | 16 ++++++++++++++++ vue/gold-system/package.json | 1 + vue/gold-system/src/main.ts | 6 ++++++ vue/gold-system/src/views/usergoldInfo/index.vue | 13 ++++++++++++- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/vue/gold-system/README.md b/vue/gold-system/README.md index aed662e..5ae1561 100644 --- a/vue/gold-system/README.md +++ b/vue/gold-system/README.md @@ -6,20 +6,21 @@ Learn more about the recommended Project Setup and IDE Support in the [Vue Docs npm install 下载依赖包 -npm run dev 启动项目 +npm run dev 启动项目 -npm install vue-router 下载vue-router组件 +npm install vue-router 下载 vue-router 组件 -npm install axios 下载axios组件 +npm install axios 下载 axios 组件 -npm install element-plus --save 下载element-plus组件 +npm install element-plus --save 下载 element-plus 组件 -npm install @element-plus/icons-vue 下载element-plus图标库 +npm install @element-plus/icons-vue 下载 element-plus 图标库 -npm install vue-icons-plus --save 下载外部图标库 +npm install vue-icons-plus --save 下载外部图标库 -npm install echarts 安装echarts组件 +npm install echarts 安装 echarts 组件 -npm install moment 安装moment组件 +npm install moment 安装 moment 组件 -npm install mathjs 安装mathjs组件,解决数据计算问题 \ No newline at end of file +npm install mathjs 安装 mathjs 组件,解决数据计算问题 +npm install vue-json-excel 安装导出 excel 组件 diff --git a/vue/gold-system/package-lock.json b/vue/gold-system/package-lock.json index 14bc872..e76bec5 100644 --- a/vue/gold-system/package-lock.json +++ b/vue/gold-system/package-lock.json @@ -16,6 +16,7 @@ "moment": "^2.30.1", "vue": "^3.5.12", "vue-icons-plus": "^0.1.7", + "vue-json-excel": "^0.3.0", "vue-router": "^4.5.0" }, "devDependencies": { @@ -1193,6 +1194,12 @@ "node": ">=0.4.0" } }, + "node_modules/downloadjs": { + "version": "1.4.7", + "resolved": "https://mirrors.huaweicloud.com/repository/npm/downloadjs/-/downloadjs-1.4.7.tgz", + "integrity": "sha512-LN1gO7+u9xjU5oEScGFKvXhYf7Y/empUIIEAGBs1LzUq/rg5duiDrkuH5A2lQGd5jfMOb9X9usDa2oVXwJ0U/Q==", + "license": "MIT" + }, "node_modules/echarts": { "version": "5.5.1", "resolved": "https://mirrors.huaweicloud.com/repository/npm/echarts/-/echarts-5.5.1.tgz", @@ -1765,6 +1772,15 @@ "vue": ">=2.7.0" } }, + "node_modules/vue-json-excel": { + "version": "0.3.0", + "resolved": "https://mirrors.huaweicloud.com/repository/npm/vue-json-excel/-/vue-json-excel-0.3.0.tgz", + "integrity": "sha512-FrSh0tVUpw4K+ilLO8g0Qp52eFJw/hkk3rZPTEKo9qVkJgVfQtZwzj3UWc5ACYxA3jLk9HtjK+f9xKHCN4Kgag==", + "license": "MIT", + "dependencies": { + "downloadjs": "^1.4.7" + } + }, "node_modules/vue-router": { "version": "4.5.0", "resolved": "https://mirrors.huaweicloud.com/repository/npm/vue-router/-/vue-router-4.5.0.tgz", diff --git a/vue/gold-system/package.json b/vue/gold-system/package.json index a629569..91b59d8 100644 --- a/vue/gold-system/package.json +++ b/vue/gold-system/package.json @@ -18,6 +18,7 @@ "moment": "^2.30.1", "vue": "^3.5.12", "vue-icons-plus": "^0.1.7", + "vue-json-excel": "^0.3.0", "vue-router": "^4.5.0" }, "devDependencies": { diff --git a/vue/gold-system/src/main.ts b/vue/gold-system/src/main.ts index 5f84645..0e243ac 100644 --- a/vue/gold-system/src/main.ts +++ b/vue/gold-system/src/main.ts @@ -6,13 +6,19 @@ import zhCn from 'element-plus/es/locale/lang/zh-cn' import 'element-plus/dist/index.css' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import './assets/css/common.css'; // 引入公共CSS文件 +import JsonExcel from 'vue-json-excel' const app = createApp(App) +// 全局注册 ElementPlus 图标 for (const [key, component] of Object.entries(ElementPlusIconsVue)) { app.component(key, component) } +// 使用 ElementPlus 和路由器 app.use(ElementPlus, { locale: zhCn, }).use(router).mount('#app'); + +// 注册 JsonExcel 组件 +app.component('downloadExcel', JsonExcel) \ No newline at end of file diff --git a/vue/gold-system/src/views/usergoldInfo/index.vue b/vue/gold-system/src/views/usergoldInfo/index.vue index aed2d03..cb3a659 100644 --- a/vue/gold-system/src/views/usergoldInfo/index.vue +++ b/vue/gold-system/src/views/usergoldInfo/index.vue @@ -193,7 +193,18 @@ onMounted(async function () {
- + + +