💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[toc] ### 1. 给下载按钮添加点击事件和方法 ### 2. 实现文件下载功能 ``` <Button icon="ios-search" class="mr-2" v-if="checkedCount" @click="downloadAll">下载</Button> <Tooltip v-if="!item.isdir" content="下载" placement="bottom"> <Icon type="md-cloud-download" size="18" class="mx-2" style="cursor: pointer;" @click="download"/> </Tooltip> download(){ this.$emit('on-event',{ type:"download", item:this.item, }) }, case 'download': this.download(e.item.url,e.item.name) downloadAll(){ this.checkList.forEach(item=>{ if(!item.isdir){ this.download(item.url,item.name) } }) }, // 下载 download(url,name){ url = url.replace('http://demo-mp3.oss-cn-shenzhen.aliyuncs.com','/oss') this.axios.get(url,{ responseType:"blob" }).then(data=>{ if(!data){ return } let url = window.URL.createObjectURL(new Blob([data])) let link = document.createElement('a') link.style.display = 'none' link.href = url link.setAttribute('download',name) document.body.appendChild(link) link.click() }) }, ```