Open clabnet opened 9 months ago
I have this tree
<vir-tree ref="virtualTree" :source="treeItemsNoChild" :default-selected-key="defaultSelectedKey" :load-data="cbGetChildren" :virtual="{ size: 26, remain: 22 }" />
To call the cbGetChildren method is required the await because it need to wait the API response.
await
const cbGetChildren = (node: BaseTreeNode, callback: (children: TreeNodeOptions[]) => void) => { console.log('[cbGetChildren]', node.key, node) let result: TreeNodeOptions[] = [] const filter = '?level=1&name=FUQF.ALB.02.201B&parent=H-FUQF' console.log('[cbGetChildren] filter:', filter) const { data } = useAxios<TreeNodeOptions[]>(`/api/bom/lite${filter}`, config.axios, { immediate: false }) result = data.value console.log('[cbGetChildren] result:', result) setTimeout(() => { callback(result) }, 200) }
Sorry for the dumb question: how to invoke the callback function with the 'async' and 'await' keywords ?
Thank's in advance
I have this tree
To call the cbGetChildren method is required the
await
because it need to wait the API response.Sorry for the dumb question: how to invoke the callback function with the 'async' and 'await' keywords ?
Thank's in advance