导出 下载excel 方案(点击下载,下载一个excel模板)
发布日期:2021-05-10 07:40:15 浏览次数:11 分类:精选文章

本文共 2377 字,大约阅读时间需要 7 分钟。

���������������������������������������������������������������������Excel������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������

exportExcel() {    // ���������������������������responseType���'arraybuffer'    userApi.sensitiveDown(this.queryParam, {responseType: 'blob'})        .then(data => {            // ���������������������Blob������            const blob = new Blob([data], {type: 'application/vnd.ms-excel'});            const link = document.createElement('a');            // ������������            link.style.display = 'none';            // ��������������������� URL            link.href = URL.createObjectURL(blob);            // ������������������������            link.download = '���������������.xlsx';            // ���������������������������            document.body.appendChild(link);            // ������������������            link.click();            // ���������������������������            document.body.removeChild(link);        });}

���������������������������������������������������������������������������

  • ������userApi.sensitiveDown���������������������������������������������'arraybuffer'���������������������������������������������������

  • ������������������������������������data���������Blob������������������������Excel���������������

  • ������������<a>������link������������������link.style.display = 'none'������������������������������������������������������������

  • ������link.href������������Excel���������URL���������������URL.createObjectURL(blob)���Blob���������������������URL���

  • ���������������������������'���������������.xlsx'���

  • ���������������������������������������������click()������������������������������������������������������

  • ���������������������������������������������������������������������������������

  • ���������������������������������������

    • ���������������������������������������������������������������������������������������������������������������
    • ���������������������������������������������������������
    • ������������������������������������������������������������Blob������������������������������������������

    ���������������������������������userApi.sensitiveDown������������������������������������������������������

    上一篇:Element UI表单中数据是字符串并含有多个内容并存时,如何进行换行展示
    下一篇:# Codeforces Round #720 (Div. 2) B. Nastia and a Good Array

    发表评论

    最新留言

    网站不错 人气很旺了 加油
    [***.192.178.218]2025年04月01日 14时38分56秒