slidev-addon-bibliography/components/Sources.vue

46 lines
1.2 KiB
Vue
Raw Normal View History

2022-12-02 16:22:19 +00:00
<script lang="ts" setup>
import { computed, inject } from 'vue';
2022-12-08 11:34:15 +00:00
import { useBibliographyStore } from '../stores/bibliography'
2022-12-02 16:22:19 +00:00
2022-12-08 11:34:15 +00:00
const bibliography = useBibliographyStore()
2022-12-02 16:22:19 +00:00
const Bibliography = inject('bibliography')
const bib = computed(() => {
2022-12-08 11:34:15 +00:00
return [...bibliography.sources]
2022-12-02 16:22:19 +00:00
.map(key => Bibliography[key])
})
2023-11-14 15:46:50 +00:00
const props = defineProps({
accessedTitle: {
default: 'accessed',
type: String,
},
})
2022-12-02 16:22:19 +00:00
</script>
<template>
<ul>
2023-11-14 18:35:33 +00:00
<li v-for="(s, index) in bib">
[{{ index }}]
2023-11-14 15:46:50 +00:00
<template v-if="typeof s.author !== 'undefined' && s.author !== ''">
2023-11-14 18:04:48 +00:00
<span class="author">{{ s.author }}</span>,
2023-11-14 15:46:50 +00:00
</template>
2023-11-14 18:04:48 +00:00
<span class="title">{{ s.title }}</span>
2023-11-14 15:46:50 +00:00
<template v-if="s.date !== '' && typeof s.date !== 'undefined'">
, ({{ s.date }})
</template>
2022-12-02 16:22:19 +00:00
<template v-if="s.url !== '' && typeof s.url !== 'undefined'">
<a :href="s.url">
2023-11-14 15:46:50 +00:00
{{ s.url }}
2022-12-02 16:22:19 +00:00
</a>
</template>
2023-11-14 15:46:50 +00:00
<template v-if="s.accessed !== '' && typeof s.accessed !== 'undefined'">
({{ accessedTitle }} {{ s.accessed }})
2022-12-02 16:22:19 +00:00
</template>
</li>
</ul>
</template>