From 3dc74473cc57a5e56b02c7f65baf4e2ad8fad40d Mon Sep 17 00:00:00 2001 From: ayang <473033518@qq.com> Date: Mon, 13 Mar 2023 18:08:11 +0800 Subject: [PATCH] perf: optimized the style of the role list --- src/components/Input/components/RoleList.vue | 83 +++++++++++--------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/src/components/Input/components/RoleList.vue b/src/components/Input/components/RoleList.vue index da8ccca..7db642f 100644 --- a/src/components/Input/components/RoleList.vue +++ b/src/components/Input/components/RoleList.vue @@ -15,16 +15,20 @@ const editItem = ref({}) const handleEdit = (data: TablePayload) => { // 修改完后没有确认修改而是直接修改另外一个 - if (editItem.value.id) handleUpdate() + handleUpdate() isEdit.value = true editItem.value = data } const handleUpdate = () => { + if (!editItem.value.id) return + isEdit.value = false - updateRole(editItem.value!) + updateRole(editItem.value) } + +watch(currentRole, handleUpdate) @@ -105,15 +111,20 @@ const handleUpdate = () => {