|
63 | 63 | </template> |
64 | 64 |
|
65 | 65 | <script lang="ts" setup> |
66 | | -import { ref, useTemplateRef } from 'vue' |
67 | | -import { dayjs, ElMessageBox } from 'element-plus' |
| 66 | +import { nextTick, ref, useTemplateRef } from 'vue' |
| 67 | +import { dayjs, ElMessage, ElMessageBox } from 'element-plus' |
68 | 68 | import { Files, Folder, FolderOpened, Refresh, Upload, DocumentAdd } from '@element-plus/icons-vue' |
69 | 69 |
|
70 | 70 | import FileView from '@/components/FileView.vue' |
@@ -105,6 +105,8 @@ const addFile = async (node: RenderContentContext['node']) => { |
105 | 105 |
|
106 | 106 | await saveFile({ path, force: true, file: new Blob([new TextEncoder().encode(' ')]) }) |
107 | 107 |
|
| 108 | + ElMessage({ type: 'success', message: '操作成功' }) |
| 109 | +
|
108 | 110 | editor.add(path, { keep: false }) |
109 | 111 |
|
110 | 112 | refreshNode(node) |
@@ -141,12 +143,22 @@ const uploadFileChange = async (e: any) => { |
141 | 143 | } |
142 | 144 | } |
143 | 145 |
|
144 | | - await saveFile({ path: `${uploadInfo.value.data.value}/${file.name}`, force: true, file }) |
| 146 | + const path = `${uploadInfo.value.data.value}/${file.name}` |
| 147 | +
|
| 148 | + await saveFile({ path, force: true, file }) |
| 149 | +
|
| 150 | + ElMessage({ type: 'success', message: '操作成功' }) |
145 | 151 |
|
146 | 152 | refreshNode(uploadInfo.value) |
147 | 153 |
|
| 154 | + editor.remove(path, true) |
| 155 | +
|
148 | 156 | e.target.value = '' |
149 | 157 | uploadInfo.value = undefined |
| 158 | +
|
| 159 | + nextTick(() => { |
| 160 | + editor.add(path, { keep: false }) |
| 161 | + }) |
150 | 162 | } |
151 | 163 |
|
152 | 164 | const refreshNode = (node: RenderContentContext['node']) => { |
|
0 commit comments