Tag remove feature

pull/9/head
MyFaith 2019-04-10 21:34:02 +08:00
parent 881674ab87
commit a14dc91ddb
3 changed files with 6 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
.DS_Store .DS_Store
node_modules node_modules
/dist /dist
yarn.lock
# local env files # local env files
.env.local .env.local

View File

@ -52,4 +52,3 @@ export default {}
padding-bottom: 0; padding-bottom: 0;
} }
</style> </style>

View File

@ -34,7 +34,7 @@
<template slot="title"> <template slot="title">
<span>{{ tag.postCount }} 篇文章</span> <span>{{ tag.postCount }} 篇文章</span>
</template> </template>
<a-tag color="green">{{ tag.name }}</a-tag> <a-tag closable @close="deleteTag(tag.id)" color="green">{{ tag.name }}</a-tag>
</a-tooltip> </a-tooltip>
</a-card> </a-card>
</a-col> </a-col>
@ -44,6 +44,7 @@
<script> <script>
import tagApi from '@/api/tag' import tagApi from '@/api/tag'
import { closeSync } from 'fs';
export default { export default {
data() { data() {
return { return {
@ -71,8 +72,9 @@ export default {
this.loadTags() this.loadTags()
}) })
}, },
deleteTag(index) { deleteTag(tagId) {
tagApi.delete(this.tags[index]).then(response => { tagApi.delete(tagId).then(response => {
this.$message.success('删除成功!')
this.loadTags() this.loadTags()
}) })
} }