💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 模拟树形结构 ``` <template> <div> <ul v-for="(item,i) in list"> <li> {{item.name}} <ul v-if="item.children "> 调用自身 <item :list="item.children"></item> </ul> </li> </ul> </div> </template> ``` ``` <script> export default { name: "item",//vue2必须有name props: { list: { type: Array, default: () => { return [ { name: "item1", children: [ { name: "item2", children: [{ name: "item2.1" }] }, { name: "item3" } ] }, { name: "item4", children: [ { name: "item5" }, { name: "item6" } ] } ]; } } }, data() { return { isShow: true }; }, computed: {}, created() {}, methods: { } }; </script> ``` ![](https://img.kancloud.cn/19/8e/198eed477efdeb3b3084de13bc3c5707_439x317.png)