diff options
| author | taehoon <th.dev91@gmail.com> | 2019-04-03 22:17:42 -0400 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-04-17 11:32:48 -0400 |
| commit | 1cec2b696952ef2c472219329961bc102ed315df (patch) | |
| tree | 8bdbb99a0a1b8acc2019d5e8b22b7bbcfe510871 /src/components/list | |
| parent | 4b292564d8add9973116b785132648ddc2be3e1a (diff) | |
use reusable List vue component instead of withList hoc
Using slot is the preferred way in vue
Diffstat (limited to 'src/components/list')
| -rw-r--r-- | src/components/list/list.vue | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/components/list/list.vue b/src/components/list/list.vue new file mode 100644 index 00000000..f361e3b1 --- /dev/null +++ b/src/components/list/list.vue @@ -0,0 +1,28 @@ +<template> + <div class="list"> + <slot name="item" v-for="item in items" :item="item" /> + <div class="list-empty-content faint" v-if="items.length === 0"> + <slot name="empty" /> + </div> + </div> +</template> + +<script> +export default { + props: { + items: { + type: Array, + default: () => [] + } + } +} +</script> + +<style lang="scss"> +.list { + &-empty-content { + text-align: center; + padding: 10px; + } +} +</style> |
