fix: bug#10844

This commit is contained in:
jackhoo_98 2023-03-24 15:34:04 +08:00
parent 3f075e6f24
commit 62bd45e624
2 changed files with 8 additions and 4 deletions

View File

@ -122,7 +122,8 @@ const table = reactive({
routeParams.id &&
getMenuInfo_api(routeParams.id).then((resp: any) => {
menuInfo.value = resp.result;
table.tableData = resp.result.buttons as tableDataItem[];
table.tableData =
(resp.result?.buttons as tableDataItem[]) || [];
});
},
clickDel: (row: tableDataItem) => {

View File

@ -95,8 +95,8 @@ const confirm = () => {
loading.value = true;
formRef.value &&
formRef.value.validate().then(() => {
const buttons = toRaw(props.menuInfo.buttons);
const button = buttons.find((item) => item.id === form.data.id);
const buttons = toRaw(props.menuInfo?.buttons);
const button = buttons?.find((item) => item.id === form.data.id);
if (button) {
Object.entries(form.data).forEach(([key, value]) => {
button[key] = value;
@ -112,7 +112,10 @@ const confirm = () => {
emits('confirm');
emits('update:visible', false);
})
.finally(() => (loading.value = false));
.finally(() => (loading.value = false))
.catch(() => {
loading.value = false;
});
});
};
const initForm = {