budibase/packages/standard-components/src/List.svelte

23 lines
437 B
Svelte
Raw Normal View History

2020-06-03 00:26:06 +02:00
<script>
import { onMount } from "svelte"
import fetchData from "./fetchData.js"
import { isEmpty } from "lodash/fp"
2020-06-03 00:26:06 +02:00
export let _bb
export let datasource = []
2020-06-03 00:26:06 +02:00
let target
onMount(async () => {
if (!isEmpty(datasource)) {
2020-10-09 13:24:18 +02:00
const data = await fetchData(datasource, _bb)
2020-06-03 00:26:06 +02:00
_bb.attachChildren(target, {
hydrate: false,
context: data,
2020-06-03 00:26:06 +02:00
})
}
})
</script>
2020-07-07 22:29:20 +02:00
<section bind:this={target} />