QYF-GitLab1
2025-03-03 67e61c4f15334a5aa8b4a4b1ddefdfe77b747ebe
src/components/TreeMenu.vue
@@ -27,7 +27,7 @@
</template>
<script setup lang="ts">
import { ref, watch,defineProps } from "vue";
import { ref, watch, defineProps } from "vue";
import { useRouter } from "vue-router";
import { Document, FolderOpened } from "@element-plus/icons-vue";
@@ -44,36 +44,24 @@
  children?: TreeNode[];
}
const treeData = ref<TreeNode[]>([
const modelTreeData = ref<TreeNode[]>([
  {
    label: "模型管理",
    icon: "Document",
    path: "/model",
  },
  {
    label: "可视化仿真",
    label: "型号",
    icon: "FolderOpened",
    children: [
      {
        label: "测试仿真",
        path: "/simulation-test",
        icon: "FolderOpened",
        children: [
          {
            label: "仿真详情",
            path: "/simulation-config",
            icon: "Document",
          },
          {
            label: "测试报告",
            path: "/simulation-result",
            icon: "Document",
          },
        ],
        label: "着陆器模型库",
        path: "/model/landerModel",
        icon: "Document",
      },
      {
        label: "实时仿真",
        path: "/simulation-test",
        label: "巡视器模型库",
        path: "/model/roverModel",
        icon: "Document",
      },
      {
        label: "飞跃器模型库",
        path: "/model/leapMachineModel",
        icon: "Document",
      },
    ],
@@ -85,7 +73,7 @@
  label: "label",
};
const filteredData = ref(treeData.value);
const filteredData = ref(modelTreeData.value);
const filterNode = (value: string, data: TreeNode) => {
  if (!value) return true;
@@ -98,11 +86,14 @@
  }
};
watch(
  () => props.menuItem,
  (value) => {
    console.log(value,'tree');
    if (value == "/" || value == "/model") {
      filteredData.value = modelTreeData.value;
    } else {
      filteredData.value = []
    }
  }
);
</script>