Hello everyone ,
so right now I have 2 components, Card and ArrowLink ,
The Card componenet contains prop called CardLink which contains the Href the image in the card will point to
Card:
<template>
<div
class="block rounded-lg bg-white shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)]">
<a :href="CardLink">
<img
class="rounded-t-lg"
:src="ImageLink"
:alt="ImageAlt"
:class="ImageStyle"
/>
</a>
<div class="p-6" :class="TextAreaStyle">
<h5
class="mb-2 text-xl font-medium leading-tight text-neutral-800 dark:text-neutral-50">
{{Title}}
</h5>
<p class="mb-4 " :class="DescriptionStyle">
{{Description}}
</p>
<slot></slot>
</div>
</div>
</template>
<script setup>
defineProps(['CardLink','ImageLink','ImageAlt','Title','DescriptionStyle','ImageStyle','Description','TextAreaStyle'])
</script>
<script>
</script>
The ArrowLink contains a prop called ALink which contains the Href of the ArrowLink componenet
ArrowLink:
<template>
<a :href="ALink" >
<svg class="rtl:rotate-180 w-3.5 h-3.5 ms-2" :class="ArrowStyle" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 10">
<path :stroke="ArrowColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5h12m0 0L9 1m4 4L9 9"/>
</svg>
</a>
</template>
<script setup>
defineProps(['ArrowStyle','ArrowColor','ALink'])
</script>
I want to pass the "CardLink" prop into the "ALink" prop so if want to change the actual link I don't need to change it twice , the implementation that I want to make it work is like this:
<card ImageLink="/Images/HomeImages/solutions/cell.jpg"
CardLink="some link"
Title="Tile text"
ImageAlt="Tower"
ImageStyle="some styling"
TextAreaStyle="Some styling"
Description=" description of the card"
>
<ArrowLink ALink="CardLink" ArrowColor="blue" ArrowStyle=""/>
</card>
How do i pass the props in the parent component prop to the child component prop ??
thank you for your help !!