webfansplz / vuejs-challenges

Collection of Vue.js challenges
https://vuejs-challenges.netlify.app/
MIT License
2.71k stars 187 forks source link

208 - 树组件 递归组件 #2809

Open Tofu-Xx opened 1 month ago

Tofu-Xx commented 1 month ago
<template>
  <!-- do something.... -->
  <ul v-for="{ key, children } of data" :key>
    <li>{{ key }}</li>
    <TreeComponent v-if="children" :data="children"></TreeComponent>
  </ul>
</template>

image