Browse Source

fix: 解决刷新页面后“问题处理通知”菜单无法选中问题

lfeish 1 year ago
parent
commit
8c1e12a605

+ 3 - 1
src/layout/components/Sider/Sider.vue

@@ -69,7 +69,7 @@
 
   // 获取当前打开的子菜单
   const matched = currentRoute.matched;
-  const activeMenu = currentRoute.meta?.activeMenu ?? null;
+  const activeMenu = currentRoute.meta?.activeMenu || null; // activeMenu undefined,null 或 空字符串,统一变为 null。
   const selectedKeys = ref<string>((activeMenu ?? currentRoute.name) as string);
   const openKeys = ref(matched && matched.length ? matched.map((item) => item.name) : []);
 
@@ -86,6 +86,8 @@
 
   const getSelectedKeys = computed(() => {
     let location = props.location;
+    console.log('location', location);
+    console.log('selectedKeys', selectedKeys.value);
     return location === 'left' || (location === 'header' && unref(navMode) === 'horizontal')
       ? unref(selectedKeys)
       : unref(headerMenuSelectKey);

+ 1 - 1
src/views/message/question-notifications/QuestionNotifications.vue

@@ -40,7 +40,7 @@
     <el-dialog
       v-model="showDialog"
       title="编辑推送文案"
-      align-center="true"
+      align-center
       width="400"
       @close="closeDialog()"
       :close-on-click-modal="false"