如何在vue.js和laravel5.4中的下载文件夹中下载文件和存储

时间:2017-05-12 06:54:44

标签: laravel vue.js laravel-5.4

我有一个名为View Resume的按钮。当用户点击按钮时,我想下载简历并将其存储在下载文件夹中。

我把简历存放在我的桌子上。我只想使用vue.js

下载它

我已经在谷歌搜索了。但我没有找到任何正确的结果。

这是我的按钮:

<ElButton  type="success"
           size="small">
  Resume
</ElButton>

有人可以帮我吗?

1 个答案:

答案 0 :(得分:2)

在vour vue组件中:

...
<button @click="getResume">Download resume</button>
...

methods: {
   ...

   getResume() {
       ...code to perform a request to the api...
   }
}

在您的API控制器中:

... code to get the path to the correct resume ...

return response()->download('...path to resume file...');
相关问题