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