mirror of https://github.com/halo-dev/halo-admin
Support journal delete.
parent
b7518ac23d
commit
6808e2ad3a
|
@ -28,4 +28,11 @@ journalApi.update = (journalId, journal) => {
|
|||
})
|
||||
}
|
||||
|
||||
journalApi.delete = journalId => {
|
||||
return service({
|
||||
url: `${baseUrl}/${journalId}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export default journalApi
|
||||
|
|
|
@ -87,7 +87,14 @@
|
|||
@click="handleEdit(item)"
|
||||
>编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="你确定要删除这条日志?"
|
||||
@confirm="handleDelete(item.id)"
|
||||
okText="确定"
|
||||
cancelText="取消"
|
||||
>
|
||||
<a href="javascript:void(0);">删除</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<a-list-item-meta :description="item.content">
|
||||
<span slot="title">{{ item.createTime | moment }}</span>
|
||||
|
@ -193,6 +200,12 @@ export default {
|
|||
this.journal = item
|
||||
this.visible = true
|
||||
},
|
||||
handleDelete(id) {
|
||||
journalApi.delete(id).then(response => {
|
||||
this.$message.success('删除成功!')
|
||||
this.loadJournals()
|
||||
})
|
||||
},
|
||||
createOrUpdateJournal() {
|
||||
if (this.journal.id) {
|
||||
journalApi.update(this.journal.id, this.journal).then(response => {
|
||||
|
|
Loading…
Reference in New Issue