diff --git a/ui/src/components/read-write/index.vue b/ui/src/components/read-write/index.vue
index 5cc99a404..013bf7fc0 100644
--- a/ui/src/components/read-write/index.vue
+++ b/ui/src/components/read-write/index.vue
@@ -21,6 +21,8 @@
autofocus
:maxlength="maxlength || '-'"
:show-word-limit="maxlength ? true : false"
+ @blur="isEdit = false"
+ @keyup.enter="submit"
>
@@ -64,6 +66,10 @@ const loading = ref(false)
watch(isEdit, (bool) => {
if (!bool) {
writeValue.value = ''
+ } else {
+ nextTick(() => {
+ inputRef.value?.focus()
+ })
}
})
@@ -80,10 +86,6 @@ function editNameHandle() {
isEdit.value = true
}
-onMounted(() => {
- nextTick(() => {
- inputRef.value?.focus()
- })
-})
+onMounted(() => {})
diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue
index 3c9b5e216..8705ed818 100644
--- a/ui/src/views/document/index.vue
+++ b/ui/src/views/document/index.vue
@@ -54,7 +54,7 @@
@@ -354,12 +354,12 @@ function changeState(bool: Boolean, row: any) {
currentMouseId.value && updateData(row.id, obj, str)
}
-function editName(val: string) {
+function editName(val: string, id: string) {
if (val) {
const obj = {
name: val
}
- currentMouseId.value && updateData(currentMouseId.value, obj, '修改成功')
+ updateData(id, obj, '修改成功')
} else {
MsgError('文件名称不能为空!')
}
diff --git a/ui/src/views/problem/index.vue b/ui/src/views/problem/index.vue
index 13d643974..a944939fc 100644
--- a/ui/src/views/problem/index.vue
+++ b/ui/src/views/problem/index.vue
@@ -42,7 +42,7 @@
{})
}
-function editName(val: string) {
+function editName(val: string, problemId: string) {
if (val) {
const obj = {
content: val
}
- problemApi.putProblems(id, currentMouseId.value, obj, loading).then(() => {
+ problemApi.putProblems(id, problemId, obj, loading).then(() => {
getList()
MsgSuccess('修改成功')
})