<template> <el-tree :data="data" show-checkbox node-key="id" ref="tree" @node-click="handleNodeClick" > </el-tree> </template> <script> export default { data() { return { data: [] }; }, methods: { handleNodeClick(data) { const node = this.$refs.tree.getNode(data); const parentNode = node.parent; if (parentNode.data) { console.log("父节点"); } } } }; </script>