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

24 lines
477 B
Svelte
Raw Normal View History

2020-06-03 00:26:06 +02:00
<script>
import { onMount } from "svelte"
import { fetchDatasource } from "../../component-sdk"
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
let store = _bb.store
2020-06-03 00:26:06 +02:00
onMount(async () => {
if (!isEmpty(datasource)) {
const data = await fetchDatasource(datasource)
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} />