slidev-addon-bibliography/components/Sources.vue

44 lines
1.2 KiB
Vue

<script lang="ts" setup>
import { computed, inject } from 'vue';
import { useBibliographyStore } from '../stores/bibliography'
const bibliography = useBibliographyStore()
const Bibliography = inject('bibliography')
const bib = computed(() => {
return [...bibliography.sources]
.map(key => Bibliography[key])
})
const props = defineProps({
accessedTitle: {
default: 'accessed',
type: String,
},
})
</script>
<template>
<ul>
<li v-for="s in bib">
<template v-if="typeof s.author !== 'undefined' && s.author !== ''">
{{ s.author }},
</template>
{{ s.title }}
<template v-if="s.date !== '' && typeof s.date !== 'undefined'">
, ({{ s.date }})
</template>
<template v-if="s.url !== '' && typeof s.url !== 'undefined'">
<a :href="s.url">
{{ s.url }}
</a>
</template>
<template v-if="s.accessed !== '' && typeof s.accessed !== 'undefined'">
({{ accessedTitle }} {{ s.accessed }})
</template>
</li>
</ul>
</template>