节点重构

This commit is contained in:
2025-02-12 14:21:19 +08:00
parent 977722f2c2
commit fb3b97fd30
3 changed files with 25 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
<div class="app-container"> <div class="app-container">
<el-container> <el-container>
<el-aside> <el-aside>
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" style="margin-bottom: 10px" clearable /> <el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" style="margin-bottom: 10px" clearable/>
<el-tree class="filter-tree" :data="groupList" @node-click="nodeClick" node-key="id" highlight-current :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" :default-expanded-keys="[0]"> <el-tree class="filter-tree" :data="groupList" @node-click="nodeClick" node-key="id" highlight-current :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" :default-expanded-keys="[0]">
<span class="custom-tree-node" slot-scope="{ node, data }" v-if="groupState !== 'list' && editId === data.id"> <span class="custom-tree-node" slot-scope="{ node, data }" v-if="groupState !== 'list' && editId === data.id">
<span> <span>
@@ -102,8 +102,10 @@ export default {
}); });
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
this.groupId = res.data[0].id; this.groupId = res.data[0].id;
this.$refs.tree.setCurrentKey(this.groupId); this.$nextTick(() => {
this.$emit('click', this.groupId); this.$refs.tree.setCurrentKey(this.groupId);
this.$emit('click', this.groupId);
})
} }
}) })
}, },

View File

@@ -1,5 +1,5 @@
<template> <template>
<folder-page type="api" @click="nodeSelected"> <folder-page type="api" @click="folderHandleSelected">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="接口名称" prop="name"> <el-form-item label="接口名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入接口名称" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.name" placeholder="请输入接口名称" clearable @keyup.enter.native="handleQuery"/>
@@ -85,7 +85,7 @@ export default {
} }
}, },
methods: { methods: {
nodeSelected(id) { folderHandleSelected(id) {
this.queryParams.groupId = id; this.queryParams.groupId = id;
this.getList(); this.getList();
}, },

View File

@@ -1,11 +1,27 @@
<template> <template>
<div> <folder-page type="case" @click="folderHandleSelected">
case case
</div> </folder-page>
</template> </template>
<script> <script>
import FolderPage from "@/components/FolderPage/index.vue";
export default {
name: "Case",
components: {FolderPage},
data() {
return {
}
},
methods: {
folderHandleSelected(id) {
console.log(id)
}
}
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">