Access route to single book form

This commit is contained in:
Artlef
2025-10-26 16:35:11 +01:00
parent 873c3c89fa
commit fd790319a9
3 changed files with 15 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
<script setup>
import { useRouter } from 'vue-router'
const props = defineProps({
id: Number,
title: String,
author: String,
imagePath: String,
@@ -8,13 +10,17 @@
read: Boolean
});
const imagePathOrDefault = (props.imagePath == "" || typeof props.imagePath === 'undefined') ? "defaultbook.png" : props.imagePath;
const router = useRouter();
function openBook() {
router.push(`/book/${props.id}`)
}
</script>
<template>
<div class="box container has-background-dark">
<div class="media">
<div class="box container has-background-dark" >
<div class="media" @click="openBook">
<div class="media-left">
<figure class="image mb-3">
<img v-bind:src="imagePathOrDefault" v-bind:alt="title">