chore: fix type error of the tree customNodeClass demo (#18920)

chore: fix type error of the tree demo
This commit is contained in:
jiaxiang 2024-11-16 21:52:39 +08:00 committed by GitHub
parent f180e0c236
commit 23ce3ff8f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@
<script lang="ts" setup>
import type Node from 'element-plus/es/components/tree/src/model/node'
import type { TreeNodeData } from 'element-plus/es/components/tree/src/tree.type'
interface Tree {
id: number
label: string
@ -22,12 +22,8 @@ interface Tree {
children?: Tree[]
}
const customNodeClass = (data: Tree, node: Node) => {
if (data.isPenultimate) {
return 'is-penultimate'
}
return null
}
const customNodeClass = ({ isPenultimate }: TreeNodeData, node: Node) =>
isPenultimate ? 'is-penultimate' : ''
const data: Tree[] = [
{