文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 78be9bfa by Wang Yuhang

实现我的发布页面中删除功能

parent a0a1bc40
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div>发布者:{{item.creator}}&emsp;&emsp;发布时间:{{item.date|formatDate}}&emsp;&emsp;任务状态:已发布 <div>发布者:{{item.creator}}&emsp;&emsp;发布时间:{{item.date|formatDate}}&emsp;&emsp;任务状态:已发布
</div> </div>
<el-button class="task-enter-btn2" type="primary" plain @click="revise">修改</el-button> <el-button class="task-enter-btn2" type="primary" plain @click="revise">修改</el-button>
<el-button class="task-enter-btn1" @click="deleteRow(index, tasks)" type="primary" plain>删除</el-button> <el-button class="task-enter-btn1" @click="deleteRow(index, item.id)" type="primary" plain>删除</el-button>
</div> </div>
</div> </div>
<navigator v-model="tasks" :condition="condition"></navigator> <navigator v-model="tasks" :condition="condition"></navigator>
...@@ -35,13 +35,28 @@ export default { ...@@ -35,13 +35,28 @@ export default {
} }
}, },
methods: { methods: {
deleteRow (index, rows) { // 删除改行 deleteRow (index, taskId) {
var self = this
this.$confirm('确定要删除吗?', '提示', { this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
rows.splice(index, 1) self.axios.get('/task/deleteTask', {
params: {
taskId
}
}).then(res => {
console.log(res)
self.tasks.splice(index, 1)
self.$message({
message: '删除成功',
type: 'success'
})
}).catch(err => {
console.log(err)
self.$message.error('删除失败,未知错误')
})
}) })
}, },
revise () { revise () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment