Skip to content

208 - 树组件 #2050

Open
Open
@kid1110

Description

@kid1110
// 你的答案
<script setup lang="ts">
interface TreeData {
  key: string
  title: string
  children: TreeData[]
}
defineProps<{data: TreeData[]}>()
</script>

<template>
  <ul v-for="{key,title,children} in data" :key="key">
    <li>
    {{title}}
    <TreeComponent v-if="children" :data="children"/>
    </li>
  </ul>
  <!-- do something.... -->
</template>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions