slidev-addon-bibliography/components/Sources.vue

46 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, index) in bib">
[{{ index }}]
<template v-if="typeof s.author !== 'undefined' && s.author !== ''">
<span class="author">{{ s.author }}</span>,
</template>
<span class="title">{{ s.title }}</span>
<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>