# vue-table-to-excel

![Travis (.com)](https://img.shields.io/travis/com/teeeemoji/vue-route-sync-mixin)
![Codecov](https://img.shields.io/coveralls/expressjs/express/master.svg)
![npm](https://img.shields.io/npm/v/vue-table-to-excel)
![npm](https://img.shields.io/npm/dy/vue-table-to-excel)
![npm bundle size](https://img.shields.io/bundlephobia/min/vue-table-to-excel?style=plastic)
![GitHub last commit](https://img.shields.io/github/last-commit/teeeemoji/vue-route-sync-mixin)
![NPM](https://img.shields.io/npm/l/vue-route-sync-mixin)


## Installation

```console
$ npm install vue-table-to-excel
```

## Usage

### Single File Component Example:
### Support for local configuration
```diff
+ component
<script>
import { jsontoexcel } from "vue-table-to-excel";
export default {
  data() {
    return {
      json: {
        dataSource: [
          { name: "Tom", phone: "+86 01012", email: "000@gmail.com" },
          { name: "Jack", phone: "+86 01012", email: "000@gmail.com" },
          { name: "Alice", phone: "+86 01012", email: "000@gmail.com" }
        ],
        head: ["name", "phone", "email"],
        fileName: "download.xlsx"
      }
    };
  },
  methods: {
    download() {
      const { data, head, fileName } = this.json;
      jsontoexcel.getXlsx(data, head, fileName);
    }
  }
};
</script>
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### getXlsx

[src/index.js:16-44](https://github.com/teeeemoji/vue-table-to-excel/blob/46c0fd0eebbc5bb7e97b38780a598ce63b6572d9/src/index.js#L16-L44 "Source code on GitHub")

A series of mixins is automatically generated for the url synchronization function

#### Parameters

-   `options`  {{}} A map of $route.query keys to vm's property path
    -   `options.KeyOfOptions`  {string} Key of options is the value key on url query string,
        and its also the key in vm.$route
    -   `options.ValueOfOptions`  {string} Value of options is a path to find the actual value in vm

Returns **{}** A series of mixins

### processEscapeStr2Value

[src/index.js:54-54](https://github.com/teeeemoji/vue-table-to-excel/blob/46c0fd0eebbc5bb7e97b38780a598ce63b6572d9/src/index.js#L54-L54 "Source code on GitHub")

-   **See: <https://www.npmjs.com/package/js-type-escape#processescapestr2value>**

process escape string to value with its data type

#### Parameters

-   `str`  {string}

Returns **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | any | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined) \| [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number))** 

### processValue2EscapeStr

[src/index.js:64-64](https://github.com/teeeemoji/vue-table-to-excel/blob/46c0fd0eebbc5bb7e97b38780a598ce63b6572d9/src/index.js#L64-L64 "Source code on GitHub")

-   **See: <https://www.npmjs.com/package/js-type-escape#processvalue2escapestr>**

process value to escape string

#### Parameters

-   `val`  {any}

Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

## TODO
-   write demo

## License

This project is licensed under the [MIT license](LICENSE).

[deeplinking]: https://en.wikipedia.org/wiki/Deep_linking
