I have a simple component:
<script setup>
import {ref} from 'vue'
const labels = []
</script>
<template>
<div v-for="(label, index) in labels" :key="index" v-html="label"></div>
</template>
My goal is to incorporate this Component into an <aside>
block displaying "side information". I want this Component to have its own data, separate from the parent element, so I can include it anywhere.
I know how to create a "full page" component where I pass data using
inertia('Page', ['labels' => ['Foo', 'Bar']])
from the controller to the vue component.
However, I am unsure of how to achieve this for the "side" component.
I have set up a route to an invokable controller that would send the data as json, but this would require me to load the data using axios in the traditional vue way.
Now I am questioning how I can accomplish this with inertia. I am aware of manual visits using router
from inertiajs/vue
, but the get
method seems more geared towards "navigating away" rather than "fetching data".