<template>
<div id="app">
<el-button @click="openFile">下载文件</el-button>
<el-button @click="openImg">下载图片</el-button>
<router-view></router-view>
</div>
</template>
<script>
export default {
name: "App",
components: {},
data() {
return {};
},
methods: {
openFile() {
//word excel 下载项目种本地资源
//window.location = `${process.env.BASE_URL}static/大.xlsx`;
window.location = `${process.env.BASE_URL}static/静态文件.docx`;
},
openImg1() {
//下载图片 下载项目种本地资源
let request = new XMLHttpRequest();
let appUrl = `${window.location.protocol}//${window.location.host}/`;
request.responseType = "blob";
let url = appUrl + `${process.env.BASE_URL}static/1.png`;
request.open("GET", url);
request.onload = functio
本文转载自: https://blog.csdn.net/jieweiwujie/article/details/133321844
版权归原作者 前端小云儿 所有, 如有侵权,请联系我们删除。
版权归原作者 前端小云儿 所有, 如有侵权,请联系我们删除。