修改文本编辑器的文件树添加删除功能

This commit is contained in:
jmal 2020-07-07 18:07:21 +08:00
parent 9d27d24876
commit 7b1035d02f

View File

@ -83,7 +83,7 @@
break break
case 'remove': case 'remove':
console.log('remove',this.contextData) console.log('remove',this.contextData)
this.delFile(this.contextData.path) this.delFile(this.contextData)
break break
default: default:
console.log('default',this.contextData) console.log('default',this.contextData)
@ -91,14 +91,20 @@
} }
}, },
// 删除文件/文件夹 // 删除文件/文件夹
delFile(path){ delFile(data){
api.delFile({ this.$confirm('此操作将永久删除' + data.name + ', 是否继续?', '提示', {
username: this.$store.state.user.name, confirmButtonText: '确定',
path: path cancelButtonText: '取消',
}).then(()=>{ type: 'warning'
let node = this.tree.getActiveNode() }).then(() => {
node.remove() api.delFile({
this.$message.success("删除成功!") username: this.$store.state.user.name,
path: data.path
}).then(()=>{
let node = this.tree.getActiveNode()
node.remove()
this.$message.success("删除成功!")
})
}) })
}, },
// 上级目录 // 上级目录