<template>
  <div v-if="show">
    <recursive v-if="items?.length" :items="items"></recursive>
  </div>
</template>
<script setup>
import recursive from './recursive'
import { getDict } from '@/hooks/web/useDictionaries'
import { ref } from 'vue';
defineOptions({ name:'common-components-areaTree'})

let items = ref() 
let children = ref() 
const show = ref(false) 
getDict('areaTreeData', {}, 'areaTreeData').then(({ data }) => {
  items.value = data?.length && data || []
  children.value = items.value[0]?.children.length && items.value[0].children || []
  show.value = true
})

</script>