2019-04-04 13:17:42 +11:00
|
|
|
<template>
|
|
|
|
<div class="list">
|
2019-04-04 14:45:45 +11:00
|
|
|
<div v-for="item in items" class="list-item" :key="getKey(item)">
|
2019-04-04 15:22:55 +11:00
|
|
|
<slot name="item" :item="item" :keyVal="getKey(item)" />
|
2019-04-04 14:45:45 +11:00
|
|
|
</div>
|
2019-04-04 18:03:47 +11:00
|
|
|
<div class="list-empty-content faint" v-if="items.length === 0 && !!$slots.empty">
|
2019-04-04 13:17:42 +11:00
|
|
|
<slot name="empty" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
items: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
2019-04-04 14:45:45 +11:00
|
|
|
},
|
|
|
|
getKey: {
|
|
|
|
type: Function,
|
2019-04-04 15:00:21 +11:00
|
|
|
default: item => item.id
|
2019-04-04 13:17:42 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2019-04-04 14:45:45 +11:00
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
2019-04-04 13:17:42 +11:00
|
|
|
.list {
|
2019-04-04 18:18:29 +11:00
|
|
|
&-item:not(:last-child) {
|
2019-04-04 14:45:45 +11:00
|
|
|
border-bottom: 1px solid;
|
|
|
|
border-bottom-color: $fallback--border;
|
|
|
|
border-bottom-color: var(--border, $fallback--border);
|
|
|
|
}
|
|
|
|
|
2019-04-04 13:17:42 +11:00
|
|
|
&-empty-content {
|
|
|
|
text-align: center;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|