# usePageDownload Hook

`usePageDownload` 是下载表格数据的hook。

## usePageDownload参数
 * columnDatas {Array} 表头数据
 * tableDatas {Array} 表格数据-传入多少数据就下载多少数据
 * name {String} 当前文件夹的名称
 * option {Object} 需要映射的列表值和映射数据组成的对象 
```js
const option = {
		status: [
			{
				label: '运行中',
				value: 'ACTIVE'
			},
			{
				label: '已关闭',
				value: 'STOPPED'
			},
		],
		region: [
			{
				label: '北京',
				value: 'cn-north-1'
			},
			{
				label: '上海',
				value: 'cn-east-1'
			},
		],
	}
```


## 功能
- `getDownDatas`:Function, 下载数据的函数。

## 使用方法

<div class="options-api">

```vue
<script setup>
import { usePageDownload } from "@ksconsole/hooks";

const columns = ref([
  {
    key: "instanceType",
    title: "数据1"
  },
  {
    key: "productType",
    title: "数据2"
  },
  {
    key: "instanceName",
    title: "数据3"
  },
  {
    key: "region",
    title: "数据4"
  }
]);
const option = {
  instanceType: [
    {label: "数据1", value: "1"},
    {label: "数据2", value: "2"}
  ],
  productType: [
    {label: "数据1", value: "1"},
    {label: "数据2", value: "2"}
  ]
}
 // tableData 是当前需要下载的数据，test是下载的文件名
const { getDownDatas } = usePageDownload(columns,tableData,'test',option);
</script>
<template>
  <KsSearch
    ...
    hasDown
    @onExport="getDownDatas"
  >
    ...
  </KsSearch>
</template>
```

</div>


