Vue バックグラウンド管理プロジェクトでローカル ファイルをダウンロードする方法

// // ローカル ダウンロード方法。ファイルはパブリック ディレクトリに配置されます。

        // タグを使用してダウンロードする

       const a = document.createElement('a')

        herf はローカルのダウンロード パスで、ファイルはパブリック ディレクトリにあります。

       a.href = './template.xlsx'

       a.download = 'テンプレート.xlsx'

       a.click()

オンラインダウンロード方法

window.location.href = 'http://zctest.wzyunzhi.cn:7070/expertFile/model/template.xlsx' 

おすすめ

転載: blog.csdn.net/Achong999/article/details/130432188