歌曲库添加下载功能
This commit is contained in:
parent
72c0fc08b4
commit
ce19454b5e
@ -71,6 +71,7 @@
|
||||
<el-table-column label="操作" width="230" >
|
||||
<template #default="scope">
|
||||
<el-button link icon="Document" @click="updateLyric(scope.row)" title="歌词"></el-button>
|
||||
<el-button link icon="Download" @click="download(scope.row)" title="下载"></el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="remove(scope.row)" title="删除"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -241,6 +242,13 @@ export default class Music extends BaseList<MusicPage> {
|
||||
this.currentRow = { ...row }
|
||||
row.isEditing = true
|
||||
}
|
||||
download(row: MusicModel) {
|
||||
const link = document.createElement('a')
|
||||
link.setAttribute('href', `/api/v2/common/music/load/${row._id}`)
|
||||
link.setAttribute('download', row.name)
|
||||
link.setAttribute('target', '_blank')
|
||||
link.click()
|
||||
}
|
||||
remove(row: MusicModel) {
|
||||
ElMessageBox.confirm(`是否确认删除 ${row.name} ?`, '确认删除', {type: 'warning'}).then(async () => {
|
||||
const data = await this.$http.delete<{params: {id: string}}, any>('/api/v2/music/delete', {params: {id: row._id}})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user