首先在.vue文件裏將樣式給寫好vue
<a style="margin-left: 55px; cursor: pointer;" @click="popExcel" > <i class="glyphicon glyphicon-download-alt" title="下載"></i> 導出獲獎列表信息 </a>web
下載的功能後臺已經都已經寫好的,因此只要展示一下就能夠了,api
直接寫個方法就好了,測試
`this
excel(date){//導出某天獲獎列表到excelspa
api.getExportAwardExcel(this.date, this.kId)excel
.then(res => {get
this.$refs.dialog3.close()it
if (this.kId === null) {//測試環境io
window.location.href = 'https://lab.yoosh.tv/mgmt/export/exportAwardExcel?date=' + this.date
}else{
window.location.href = 'https://lab.yoosh.tv/mgmt/export/exportAwardExcel?date=' + this.date + '&kId=' + this.kId
}
if (res.data.ok) {
console.log(res.data)
}
}).catch(err => {
alert(err)
})
},
` 不少時候實際上是一個很簡單的功能,因此就不須要搞得太複雜化,簡單點。