fix: 修复createFolder方法未正确添加到Vue methods中的问题

问题: 点击"新建文件夹"按钮时控制台报错 "createFolder is not a function"
原因: 之前使用正则表达式添加方法时没有成功匹配,导致方法未被添加
修复: 手动在renameFile方法后面正确添加createFolder方法

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
WanWanYun
2025-11-15 23:50:27 +08:00
parent e5c932a351
commit de3b75c536

View File

@@ -858,6 +858,41 @@ handleDragLeave(e) {
} }
}, },
// 创建文件夹
async createFolder() {
const folderName = this.createFolderForm.folderName.trim();
if (!folderName) {
this.showToast('error', '错误', '请输入文件夹名称');
return;
}
// 前端验证文件夹名称
if (folderName.includes('/') || folderName.includes('\\') || folderName.includes('..') || folderName.includes(':')) {
this.showToast('error', '错误', '文件夹名称不能包含特殊字符 (/ \\ .. :)');
return;
}
try {
const response = await axios.post(`${this.apiBase}/api/files/mkdir`, {
path: this.currentPath,
folderName: folderName
}, {
headers: { 'Authorization': `Bearer ${this.token}` }
});
if (response.data.success) {
this.showToast('success', '成功', '文件夹创建成功');
this.showCreateFolderModal = false;
this.createFolderForm.folderName = '';
await this.loadFiles(); // 刷新文件列表
}
} catch (error) {
console.error('[创建文件夹失败]', error);
this.showToast('error', '错误', error.response?.data?.message || '创建文件夹失败');
}
},
confirmDeleteFile(file) { confirmDeleteFile(file) {
const fileType = file.isDirectory ? '文件夹' : '文件'; const fileType = file.isDirectory ? '文件夹' : '文件';
const warning = file.isDirectory ? "\n注意只能删除空文件夹" : ""; const warning = file.isDirectory ? "\n注意只能删除空文件夹" : "";