This article is documentation that describes the encapsulated utility functions exports functions
peculiarity: High scalability, flexible and convenient calling
More
- Common functions lazy-js-utils
- Threejs simplistic s-three
- Echarts simplistic s-charts
- numsWheel component s-nums-wheel
- vAxios Request encapsulationv-axios
Instructions for use
npm i exports-function # install
import {
jsonExportZip,
...
} from 'exports-function' # Ingestion on demand
Directory structure
00jsonExportZipJson is exported as a zip file01tableExportExcelHTMLTableElement Convert to Excel export02jsonExportExcelJson is exported to excel03exportPdfExport the pdf file
jsonExportZip
- jJson is exported as a zip file
- params:
- header: string[]
- data: any[][]
- fileName: string
jsonExportZip({
header: ['colums1', 'colums2', 'colums3'],
data: [
['data1', 'data2', 'data3'],
['data4', 'data5', 'data6'],
['data7', 'data8', 'data9'],
],
fileName: 'test',
})
tableExportExcel
- HTMLTableElement Convert to Excel export
- params:
- table: HTMLTableElement | string
- filename: string = 'test.xlsx
- sheetname: string = 'sheet1'
tableExportExcel('.my-table', 'table表格.xlsx') // Export the table .xlsx of the .my-table element
jsonExportExcel
- Json is exported to excel
- params:
- exportExcelOptions: { multiHeader?: [], header: [], data: any[][], filename?: string = 'excel-list', merges?: string[] = [], autoWidth: Boolean = false, bookType?: string = 'xlsx', sheetName?:string = 'sheet1', }
jsonExportExcel({
header: ['Name', 'Age', 'Gender'],
data: [
['Little King', '18', 'Male'],
['Little Lee', '20', 'Male'],
['Xiao Zhao', '21', 'male'],
['Xiao Zhang', '22', 'male'],
['Xiao Liu', '23', 'male'],
],
fileName: 'Information on students in the second class of the third year',
bookType: 'xlsx',
sheetName: 'Student Information Form',
}) // Export information .xlsx for students in the second class of the third year
exportPdf
- Export the pdf file
- params:
- src: Picture address
- filename: filename
exportPdf('./a.jpg', 'xxx') // Export xxx .pdf