fix: 修改菜单判断逻辑

This commit is contained in:
AN 2025-05-17 12:24:55 +08:00
parent 46bef43281
commit 286ca7255d

View File

@ -107,7 +107,7 @@ function handleInitModel() {
} }
iconType.value = model.icon?.startsWith('local-icon-') ? '2' : '1'; iconType.value = model.icon?.startsWith('local-icon-') ? '2' : '1';
if (model.isFrame !== '2') { if (model.isFrame === '1') {
const queryObj: { [key: string]: string } = JSON.parse(model.queryParam || '{}'); const queryObj: { [key: string]: string } = JSON.parse(model.queryParam || '{}');
queryList.value = Object.keys(queryObj).map(item => ({ key: item, value: queryObj[item] })); queryList.value = Object.keys(queryObj).map(item => ({ key: item, value: queryObj[item] }));
} }
@ -126,7 +126,6 @@ async function handleSubmit() {
parentId, parentId,
menuName, menuName,
orderNum, orderNum,
queryParam,
isFrame, isFrame,
isCache, isCache,
menuType, menuType,
@ -137,10 +136,13 @@ async function handleSubmit() {
remark remark
} = model; } = model;
if (isFrame !== '2' && queryList.value.length) { let queryParam = model.queryParam;
if (isFrame === '0') {
queryParam = '';
} else if (isFrame === '1' && queryList.value.length) {
const queryObj: { [key: string]: string } = {}; const queryObj: { [key: string]: string } = {};
queryList.value.forEach(item => (queryObj[item.key] = item.value)); queryList.value.forEach(item => (queryObj[item.key] = item.value));
model.queryParam = JSON.stringify(queryObj); queryParam = JSON.stringify(queryObj);
} }
const path = model.path?.startsWith('/') ? model.path?.substring(1) : model.path; const path = model.path?.startsWith('/') ? model.path?.substring(1) : model.path;