2019-04-03 19:17:42 -07:00
|
|
|
<template>
|
|
|
|
<div class="list">
|
2019-04-03 20:45:45 -07:00
|
|
|
<div v-for="item in items" class="list-item" :key="getKey(item)">
|
2019-04-03 21:22:55 -07:00
|
|
|
<slot name="item" :item="item" :keyVal="getKey(item)" />
|
2019-04-03 20:45:45 -07:00
|
|
|
</div>
|
2019-04-03 19:17:42 -07:00
|
|
|
<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: () => []
|
2019-04-03 20:45:45 -07:00
|
|
|
},
|
|
|
|
getKey: {
|
|
|
|
type: Function,
|
2019-04-03 21:00:21 -07:00
|
|
|
default: item => item.id
|
2019-04-03 19:17:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2019-04-03 20:45:45 -07:00
|
|
|
@import '../../_variables.scss';
|
|
|
|
|
2019-04-03 19:17:42 -07:00
|
|
|
.list {
|
2019-04-03 20:45:45 -07:00
|
|
|
&-item {
|
|
|
|
border-bottom: 1px solid;
|
|
|
|
border-bottom-color: $fallback--border;
|
|
|
|
border-bottom-color: var(--border, $fallback--border);
|
|
|
|
}
|
|
|
|
|
2019-04-03 19:17:42 -07:00
|
|
|
&-empty-content {
|
|
|
|
text-align: center;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|