vue-table-to-excel
v1.0.6
Published
Export the json data as an excel spreadsheet
Downloads
1,635
Readme
vue-table-to-excel
Installation
$ npm install vue-table-to-excel
Usage
Single File Component Example:
Support for local configuration
+ component
<script>
import { jsontoexcel } from "vue-table-to-excel";
export default {
data() {
return {
json: {
dataSource: [
{ name: "Tom", phone: "+86 01012", email: "[email protected]" },
{ name: "Jack", phone: "+86 01012", email: "[email protected]" },
{ name: "Alice", phone: "+86 01012", email: "[email protected]" }
],
head: ["name", "phone", "email"],
fileName: "download.xlsx"
}
};
},
methods: {
download() {
const { data, head, fileName } = this.json;
jsontoexcel.getXlsx(data, head, fileName);
}
}
};
</script>
API
getXlsx
A series of mixins is automatically generated for the url synchronization function
Parameters
options
{{}} A map of $route.query keys to vm's property pathoptions.KeyOfOptions
{string} Key of options is the value key on url query string, and its also the key in vm.$routeoptions.ValueOfOptions
{string} Value of options is a path to find the actual value in vm
Returns {} A series of mixins
processEscapeStr2Value
process escape string to value with its data type
Parameters
str
{string}
Returns (string | any | undefined | number)
processValue2EscapeStr
process value to escape string
Parameters
val
{any}
Returns string
TODO
- write demo
License
This project is licensed under the MIT license.