更新记录
1.0.1(2025-04-01) 下载此版本
更新使用说明
1.0.0(2025-04-01) 下载此版本
基于renderjs以及xlsx插件 导出excel xlsx文件, 仅支持app使用(ios和安卓)
平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
HBuilderX 3.1.0 app-vue | × | × | × | × | × | × |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 | 鸿蒙元服务 |
---|---|---|---|---|
× | × | × | × | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × |
k-xlsx-export
基于 renderjs 和 xlsx 库 开发的 excel 文件(.xlsx)导出插件,仅支持 app 使用(h5 方案可自行查询,解决方法很多)
平台兼容
App | ios | Android |
---|---|---|
√ | √ | √ |
注意
- 由于 renderjs 限制 vue3 请使用 非 setup 格式开发使用
- 请先下载 xlsx(npm install xlsx)
如何使用 一、通过 renderjs 引用插件(module 名字可自定义, 注意 src 路径是否正确)
<script lang="renderjs" module="exportJs" src="../../uni_modules/k-xlsx-export/index.js" ><script>
三、在页面上使用(exportJs 即 对应的 module 名字)
<button
:prop="testExportProp"
:change:prop="exportJs.getExportData"
@click="exportJs.exportExcel"
>
导出 excel
</button>
四、参数及方法介绍 在 vue data 中定义该数据结构(prop 名字可自定义)
data(){
return {
testExportProp : {
exportData: [], // 导出数据 [{key:value}]
exportName: '', // 导出文件名字 string
hideTimeName: false, // 导出名字是否隐藏时间戳
sheetNameList: [], //表头名字 ['string'],不传则取 exportData key
}
}
}
导出完成后可通过 exportOver 事件来进行事件回调 例:
methods:{
exportOver(filePath){ // filePath:文件保存路径
console.log(filePath)
uni.showToast(....)
}
}
联系
如有使用问题,可通过邮箱联系作者。