downloadFile
下载文件
Demo
Usage
ts
<template>
<div class="">
<c-button @click="download">下载文件</c-button>
</div>
</template>
<script lang="ts" setup>
import { downloadFile } from '@morehook/utils'
const originFile =
'https://cdn.staticaly.com/gh/M-cheng-web/image-provider@main/morehook/RE4wB6h.3x93ajva7f60.webp'
function download() {
downloadFile(originFile, 'xxx')
}
</script>
Type Declarations
typescript
/**
* 下载文件
* @param url 文件远程路径
* @param fileName 下载的文件名
*/
export declare function downloadFile(url: string, fileName?: string): void