后台返回的数据如下

`

"result": [

{

"checked": false,

"children": [

{

"checked": false,

"children": [ ],

"id": "ca5cfb39dc094bf7ad8ddc539b901aa0",

"name": "化学项目",

"nocheck": false,

"pid": "c14372129a4446dd9b0781b6884ecd7d"

}

],

"id": "c14372129a4446dd9b0781b6884ecd7d",

"name": "化学",

"nocheck": true,

"pid": ""

},

{

"checked": false,

"children": [

{

"checked": false,

"children": [ ],

"id": "594a902894694aa69d18b0864ce99775",

"name": "铵盐",

"nocheck": false,

"pid": "fd7ec3917b094c0698fd575cb9d81e37"

},

{

"checked": false,

"children": [ ],

"id": "6afa76035b1047fa97d3efa59b93f3b0",

"name": "亚硝酸盐",

"nocheck": false,

"pid": "fd7ec3917b094c0698fd575cb9d81e37"

}

],

"id": "fd7ec3917b094c0698fd575cb9d81e37",

"name": "水质",

"nocheck": true,

"pid": ""

}

],

`

使用el-tree 如何在仅仅获取当前选中的子节点的id 而不包含父级节点id

this.$refs.tree.getCheckedKeys(); 这个貌似是包含父级id的方法

Logo

前往低代码交流专区

更多推荐