To download the front-end file, you need to download the form template on the back-end server at the front end.

The

backend provides a RESTful for a get request. You can download it by typing it directly in the browser, but not if you call it in the code. The return value is the file information in Excel. There is no action to download the file. In the
front end, I click the button directly and then call the api.

currently use the a tag to open the backend url, but to request the url, you need to add token information to the header and what to do.

<a :href="downLoadSrc" download class="downLoad-btn">
//url
self.downLoadSrc="http://172.21.81.160:8085/storemonitor/api/v1.0/inspect/template";

clipboard.png

Mar.11,2022

the easiest way: open url window.open ("/ / xxx.net") with a new window in js;


you can try the download attribute of the a tag. For example, to download a picture, you can write:

<a href="xxx.jpg" download></a>

without the download attribute, clicking it will directly open a new tab.

By the same token, your excel here should be OK, too. However, it seems that the backend also needs to configure the header information to support the download of the download attribute.

Menu