Js下载文件

Js下载文件

    /**
     * 下载文件
     * @param path
     * @param name
     */
    downFile (path, name) {
      let link = document.createElement('a')
      link.style.display = 'none'
      link.href = path
      link.setAttribute('download', name)
      document.body.appendChild(link)
      link.click()
    }
posted @ 2022-08-26 18:13  爱吃糖的橘猫  阅读(10)  评论(0编辑  收藏  举报