diff --git a/src/pages/fileDoc/index.vue b/src/pages/fileDoc/index.vue index 0256114..c46a494 100644 --- a/src/pages/fileDoc/index.vue +++ b/src/pages/fileDoc/index.vue @@ -12,7 +12,55 @@ + + handleCommand(command)" + > + + + + + + + + + {{ item.label }} + + + + + + + + + + + + + + + + + + + + + {{ scope.row[col.prop] }} + + + + + + + + + 删除 + + ('card') const dropdownMenu = computed(() => { if (isRootMd.value) { @@ -211,6 +310,13 @@ function onNewMarkdown() { dataList.value.push(markdown) onRename(markdown) } + +async function handleCommand(command: string) { + setTimeout(() => { + onCommand(command, 'custom') + }, 800) +} + const curCommand = ref('') function onCommand(command: string, item: any) { curCommand.value = command @@ -289,7 +395,7 @@ function onFileOpen(item: any) { const editInputRefs = ref({}) function setInputRefs(el: any, id: number) { if (el) { - editInputRefs.value[`editInputRef_${id}`] = el + editInputRefs.value[`editInputRef_${listLayout.value}_${id}`] = el } } @@ -298,7 +404,6 @@ async function onSaveRename(item: any) { const find = findItem(item.id) if (!find.isEdit) return await nextTick() - debugger find.isEdit = false if (find.type === floeType.file && !editFileName.value.endsWith('.md')) { editFileName.value += '.md' @@ -316,8 +421,8 @@ async function onRename(item: any) { find.isEdit = true editFileName.value = find.name await nextTick() - editInputRefs.value[`editInputRef_${item.id}`].focus() - editInputRefs.value[`editInputRef_${item.id}`].select() + editInputRefs.value[`editInputRef_${listLayout.value}_${item.id}`].focus() + editInputRefs.value[`editInputRef_${listLayout.value}_${item.id}`].select() } const findItem = (id: number) => dataList.value.find((v: any) => v.id === id) @@ -517,5 +622,27 @@ onMounted(() => { } } } + .table { + .edit-name-col { + display: flex; + align-items: center; + width: 100%; + column-gap: 4px; + .edit-icon { + display: none; + color: var(--icon-hover-color); + cursor: pointer; + :hover { + color: var(--icon-color); + } + } + } + :deep(.el-table__row) { + cursor: pointer; + &:hover .edit-icon { + display: block; + } + } + } } diff --git a/src/pages/fileDoc/utils.ts b/src/pages/fileDoc/utils.ts index f87572d..a009c12 100644 --- a/src/pages/fileDoc/utils.ts +++ b/src/pages/fileDoc/utils.ts @@ -66,3 +66,21 @@ function removePrefixFromImages(str: string, prefix: string) { return `})` }) } + +export const folderCol = [ + { + label: '名称', + prop: 'name', + width: '10%', + }, + { + label: '类型', + prop: 'type', + width: '10%', + }, + { + label: '发布状态', + prop: 'isDraft', + width: '10%', + }, +]