Manage display of book covers
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getImagePathOrDefault } from './api.js'
|
||||
|
||||
const props = defineProps({
|
||||
id: Number,
|
||||
title: String,
|
||||
author: String,
|
||||
imagePath: String,
|
||||
coverPath: String,
|
||||
rating: Number,
|
||||
read: Boolean
|
||||
});
|
||||
const imagePathOrDefault = (props.imagePath == "" || typeof props.imagePath === 'undefined') ? "defaultbook.png" : props.imagePath;
|
||||
const router = useRouter();
|
||||
const imagePathOrDefault = computed(() => getImagePathOrDefault(props.coverPath));
|
||||
const router = useRouter();
|
||||
|
||||
function openBook() {
|
||||
router.push(`/book/${props.id}`)
|
||||
|
||||
Reference in New Issue
Block a user